feat: add finalise logic
Some checks failed
Format / formatting (push) Failing after 6s
Build / build (push) Successful in 41s
CI / build (push) Failing after 12s

This commit is contained in:
Mohamed Maoulainine Maoulainine
2025-05-10 17:59:05 +02:00
parent 27adc81ddc
commit f5aba70017
4 changed files with 44 additions and 7 deletions

View File

@ -3,6 +3,7 @@ import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { jwtDecode } from "jwt-decode"; // i hope this doesn't break the code later
import { store } from "../main.ts";
import { checkPending } from "@/services/Apis/Unauth";
import Header from "@/components/HeaderComponent.vue";
const router = useRouter();
@ -22,18 +23,39 @@ onMounted(() => {
if (roles.includes("MyINPulse-admin")) {
router.push("/admin");
} else if (roles.includes("MyINPulse-entrepreneur")) {
return;
}
if (roles.includes("MyINPulse-entrepreneur")) {
router.push("/canvas");
return;
}
else{
router.push("/JorCproject")
}
checkPending(
(response) => {
const isValidated = response.data === true;
if (isValidated) {
router.push("/JorCproject");
} else {
router.push("/finalize");
}
},
(error) => {
if (error.response?.status === 404) {
router.push("/finalize");
} else {
console.error(
"Unexpected error during checkPending",
error
);
}
}
);
} catch (err) {
console.error("Failed to decode token", err);
}
}
});
</script>
<template>