feat: update login feature

This commit is contained in:
hanif salafi 2025-07-18 15:24:36 +07:00
parent 1ef498179c
commit 38c5b513ff
2 changed files with 97 additions and 111 deletions

View File

@ -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.");
}

View File

@ -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);