feat: add finalise logic
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user