feat: update login feature
This commit is contained in:
parent
1ef498179c
commit
38c5b513ff
|
|
@ -148,19 +148,6 @@ const LoginForm = () => {
|
|||
const profile = await getProfile(access_token);
|
||||
console.log("PROFILE : ", profile?.data?.data);
|
||||
|
||||
if (
|
||||
profile?.data?.data?.isInternational == true ||
|
||||
profile?.data?.data?.isActive == false ||
|
||||
profile?.data?.data?.isDelete == true
|
||||
) {
|
||||
Object.keys(Cookies.get()).forEach((cookieName) => {
|
||||
Cookies.remove(cookieName);
|
||||
});
|
||||
warning(
|
||||
"Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri",
|
||||
"/auth/login"
|
||||
);
|
||||
} else {
|
||||
Cookies.set("home_path", profile?.data?.data?.homePath, {
|
||||
expires: 1,
|
||||
});
|
||||
|
|
@ -261,7 +248,6 @@ const LoginForm = () => {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err: any) {
|
||||
toast.error(err.message || "An unexpected error occurred.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,14 +105,14 @@ export const useAuth = (): AuthContextType => {
|
|||
}
|
||||
|
||||
// Validate user eligibility
|
||||
if (!isUserEligible(profile)) {
|
||||
clearAllCookies();
|
||||
warning(
|
||||
"Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri",
|
||||
"/auth"
|
||||
);
|
||||
return;
|
||||
}
|
||||
// if (!isUserEligible(profile)) {
|
||||
// clearAllCookies();
|
||||
// warning(
|
||||
// "Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri",
|
||||
// "/auth"
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Set profile cookies
|
||||
setProfileCookies(profile);
|
||||
|
|
|
|||
Loading…
Reference in New Issue