fix: handlers weren't used properly in the unauth code
This commit is contained in:
parent
4c15cab607
commit
6b49bbbe57
@ -25,19 +25,16 @@ onMounted(() => {
|
||||
router.push("/admin");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (roles.includes("MyINPulse-entrepreneur")) {
|
||||
router.push("/canvas");
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
checkPending(
|
||||
(response) => {
|
||||
const isValidated = response.data === true;
|
||||
if (
|
||||
isValidated &&
|
||||
roles.includes("MyINPulse-entrepreneur")
|
||||
) {
|
||||
if (isValidated && roles.includes("MyINPulse-entrepreneur")) {
|
||||
router.push("/canvas");
|
||||
//router.push("/JorCproject");
|
||||
} else {
|
||||
|
@ -74,15 +74,27 @@ function getAllEntrepreneurs(
|
||||
});
|
||||
}
|
||||
|
||||
function checkPending(): Promise<boolean> {
|
||||
return axiosInstance
|
||||
function checkPending(
|
||||
onSuccessHandler?: (response: AxiosResponse<boolean>) => void,
|
||||
onErrorHandler?: (error: AxiosError) => void
|
||||
): void {
|
||||
axiosInstance
|
||||
.get("/unauth/check-if-not-pending")
|
||||
.then((response) => response.data)
|
||||
.then((response) => {
|
||||
if (onSuccessHandler) {
|
||||
onSuccessHandler(response);
|
||||
} else {
|
||||
defaultApiSuccessHandler(response);
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
throw error;
|
||||
if (onErrorHandler) {
|
||||
onErrorHandler(error);
|
||||
} else {
|
||||
defaultApiErrorHandler(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
finalizeAccount,
|
||||
getAllEntrepreneurs,
|
||||
|
Loading…
x
Reference in New Issue
Block a user