From cb9a7a97828a9d08499b90580088e430c92c9bd6 Mon Sep 17 00:00:00 2001 From: Rishabh Taparia Date: Thu, 22 Oct 2020 13:09:43 +0530 Subject: [PATCH 1/3] Removed all unwanted warnings and errors from frontend code --- public/src/admin/admin.jsx | 13 ++++++++++- public/src/admin/sub_buttons.jsx | 2 +- public/src/student/cert-upload/cert-upl.jsx | 25 +++++++++++---------- public/src/student/navbar/navbar.jsx | 2 +- public/src/student/status/status.jsx | 3 +++ 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/public/src/admin/admin.jsx b/public/src/admin/admin.jsx index 1df8032..b1731a2 100644 --- a/public/src/admin/admin.jsx +++ b/public/src/admin/admin.jsx @@ -97,6 +97,7 @@ function Admin() { setLoad(false); }) .catch((err) => {}); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isRefreshing]); const createButton = () => { var buttons = []; @@ -104,7 +105,9 @@ function Admin() { certReq.map((certreq) => { certreq.certificates.forEach((cert) => { certs.push(certreq); + return 0; }); + return 0; }); certs = [...new Set(certs)]; certs.map((item, index) => { @@ -120,6 +123,7 @@ function Admin() { ); + return 0; }); return buttons; }; @@ -141,6 +145,7 @@ function Admin() { temp["name"] = cert["name"]; excelData.push(temp); } + return 0; }); } else if ( certreq.certificate_type === "Course Re-Registration" || @@ -162,6 +167,7 @@ function Admin() { temp["name"] = cert["name"]; excelData.push(temp); } + return 0; }); } else { certreq.certificates.map((cert) => { @@ -197,6 +203,7 @@ function Admin() { temp["name"] = cert["name"]; excelData.push(temp); } + return 0; }); } if (excelData.length) { @@ -271,6 +278,8 @@ function Admin() { {createButton().filter((button) => { if (button.props.id === cert.certificate_type) return button; + else + return 0; })} {(pending === 0 && @@ -535,7 +544,8 @@ function Admin() { ); } - } + return 0; + } )} @@ -842,6 +852,7 @@ function Admin() { ); } + return 0; } )} diff --git a/public/src/admin/sub_buttons.jsx b/public/src/admin/sub_buttons.jsx index b752dcb..97015b6 100644 --- a/public/src/admin/sub_buttons.jsx +++ b/public/src/admin/sub_buttons.jsx @@ -108,7 +108,7 @@ export const AddEmailDetails = (props) => { const approveHandler = (e) => { e.preventDefault(); setLoading(true); - if (document.getElementById("upload-cert").files.length != 0) { + if (document.getElementById("upload-cert").files.length !== 0) { let data = new FormData(); if (document.getElementById("upload-cert").files[0]) { let all_files = document.getElementById("upload-cert").files; diff --git a/public/src/student/cert-upload/cert-upl.jsx b/public/src/student/cert-upload/cert-upl.jsx index 3dc5cc7..3e8b30d 100644 --- a/public/src/student/cert-upload/cert-upl.jsx +++ b/public/src/student/cert-upload/cert-upl.jsx @@ -2,7 +2,7 @@ import React, { useState, useEffect, useContext } from "react"; import spider from "../../utils/API"; import { StatusContext } from "../../contexts/StatusContext"; import { ToastContainer } from "react-toastify"; -import { Modal } from "react-bootstrap"; +import { Modal } from "react-bootstrap"; //eslint-disable-next-line import CertificateTemplate from "../cert-templates/cert-temp"; import Loader from "react-loader-spinner"; import InstructionsModal from "../instructions-modal/instructions"; @@ -206,7 +206,7 @@ function Upload(props) { if (file === "transcript" || file === "rank card") { if (no_of_copies) cd.set("no_copies", no_of_copies); } - cd.set("path", emails.toString()); + cd.set("path", emails.toString()); //eslint-disable-next-line for (var pair of cd.entries()) { } spider @@ -371,8 +371,8 @@ function Upload(props) { let certType = e.target.value; setFile(certType); docId.forEach((type) => { - if (type.name.toLowerCase() == certType) { - if (type.semwise_mapping == true) setSemwiseMap(true); + if (type.name.toLowerCase() === certType) { + if (type.semwise_mapping === true) setSemwiseMap(true); else setSemwiseMap(false); } }); @@ -445,7 +445,7 @@ function Upload(props) { {file === "transcript" || file === "rank card" || - semwiseMap == true ? ( + semwiseMap === true ? ( <>
); + return 0; }) ) : ( @@ -770,7 +771,7 @@ function Upload(props) { {/* Fee Receipt */} {file === "transcript" || file === "rank card" || - semwiseMap == true ? ( + semwiseMap === true ? (