Skip to content
Snippets Groups Projects
Commit ff9b9a96 authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira
Browse files

State validado, falta jogar pro back

parent b770fbb0
No related branches found
No related tags found
No related merge requests found
Pipeline #38598 passed
......@@ -6,8 +6,6 @@ import { useEffect } from "react";
export default function Govbr() {
const searchParams = useSearchParams();
const state = searchParams.get("state");
const prev_state = localStorage.getItem("govbr_state", state);
const validate = async () => {
try {
......@@ -19,6 +17,17 @@ export default function Govbr() {
useEffect(() => {
const validateState = () => {
if (!localStorage.getItem("govbr_state", state)) {
console.error("local storage não possui state anterior.")
}
const prev_state = localStorage.getItem("govbr_state", state);
if (!searchParams.get("state")) {
console.error("Não existe state na URL.")
}
const state = searchParams.get("state");
if (!prev_state || !state) {
console.error("State não encontrado!\nprev_state: ", prev_state, "\nstate: ", state);
}
......@@ -27,8 +36,9 @@ export default function Govbr() {
console.error("States diferentes! Abortando.\nprev_state: ", prev_state, "\nstate: ", state);
}
console.log("Funcionou")
console.log("State validado com sucesso!")
}
validateState()
}, [searchParams, prev_state, state]);
}, [searchParams]);
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment