From 92c99bf30a711675970398cfa10b5f0e347c18df Mon Sep 17 00:00:00 2001 From: Joabesv Date: Fri, 24 May 2024 14:56:42 -0300 Subject: [PATCH] run linter --- src/scripts/contentScriptSigaa.js | 32 +++++++++++-------- src/utils/nextToasts.js | 53 ++++++++++++++++--------------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/scripts/contentScriptSigaa.js b/src/scripts/contentScriptSigaa.js index c965de4..75ef5f2 100644 --- a/src/scripts/contentScriptSigaa.js +++ b/src/scripts/contentScriptSigaa.js @@ -1,6 +1,10 @@ import { scrapeGradesConsulting, scrapeHomepage } from "../utils/sigaa"; import { NextAPI } from "../services/NextAPI"; -import { errorToast, redirectToast, processingToast } from "../utils/nextToasts"; +import { + errorToast, + redirectToast, + processingToast, +} from "../utils/nextToasts"; const nextApi = NextAPI(); @@ -12,21 +16,23 @@ if ( document.contains(document.querySelector("#agenda-docente")) ) { const student = scrapeHomepage(); - const toast = redirectToast(student.name); + const toast = redirectToast(student.name); localStorage.setItem("studentInfo", JSON.stringify(student)); - toast.showToast(); + toast.showToast(); } if (isDiscentesPath && document.contains(document.querySelector(".notas"))) { - processingToast.showToast(); - const studentHistory = scrapeGradesConsulting(); - const { data: res } = nextApi.post("/histories/sigaa", studentHistory, { - timeout: 60 * 1 * 1000, // 1 minute - }).catch(err => { - processingToast.hideToast(); - console.log(err); - errorToast.showToast(); - }); + processingToast.showToast(); + const studentHistory = scrapeGradesConsulting(); + const { data: res } = nextApi + .post("/histories/sigaa", studentHistory, { + timeout: 60 * 1 * 1000, // 1 minute + }) + .catch((err) => { + processingToast.hideToast(); + console.log(err); + errorToast.showToast(); + }); - console.log(res) + console.log(res); } diff --git a/src/utils/nextToasts.js b/src/utils/nextToasts.js index ade5bec..6e1835e 100644 --- a/src/utils/nextToasts.js +++ b/src/utils/nextToasts.js @@ -8,40 +8,41 @@ const errorSVG = require("../images/error.svg"); Utils.injectStyle("styles/portal.css"); const errorToast = Toastify({ - text: ` + text: `
Não foi possível salvar seus dados, recarregue a página e aguarde.
`, - duration: -1, - close: true, - gravity: "top", - position: "right", - className: "toast-error-container", - escapeMarkup: false, - style: { - background: "#E74C3C;", - }, + duration: -1, + close: true, + gravity: "top", + position: "right", + className: "toast-error-container", + escapeMarkup: false, + style: { + background: "#E74C3C;", + }, }); -const redirectToast = (studentname) => Toastify({ - text: ` +const redirectToast = (studentname) => + Toastify({ + text: `

${studentname} Acesse suas notas!

\n\n Clique no menu Ensino > consultar minhas notas
`, - gravity: "bottom", - position: "right", - duration: 5000, - style: { - background: - "linear-gradient(to right, #2E7EED, rgba(46, 126, 237, 0.5));", - }, - escapeMarkup: false, -}); + gravity: "bottom", + position: "right", + duration: 5000, + style: { + background: + "linear-gradient(to right, #2E7EED, rgba(46, 126, 237, 0.5));", + }, + escapeMarkup: false, + }); -const processingToast = Toastify({ +const processingToast = Toastify({ text: `
@@ -62,7 +63,7 @@ const processingToast = Toastify({ }); module.exports = { - errorToast, - redirectToast, - processingToast, -} + errorToast, + redirectToast, + processingToast, +};