Deskripsi:
- Fitur logs untuk update foto profile
- Fitu logs untuk update background profile
This commit is contained in:
2024-12-17 11:12:27 +08:00
parent 943f16cb2f
commit 11b9383141
9 changed files with 129 additions and 81 deletions

View File

@@ -65,13 +65,13 @@ export default function Register() {
const result = await res.json();
if (res.status === 200) {
localStorage.removeItem("hipmi_auth_code_id");
ComponentGlobal_NotifikasiBerhasil(result.message);
router.push("/dev/home", { scroll: false });
localStorage.removeItem("hipmi_auth_code_id");
await auth_funDeleteAktivasiKodeOtpByNomor({
nomor: data.nomor,
});
router.push("/dev/home", { scroll: false });
return;
}
if (res.status === 400) {

View File

@@ -59,11 +59,7 @@ export default function Validasi() {
}
}, [triggerOtp]);
async function onCheckAuthCode({
kodeId,
}: {
kodeId: string;
}) {
async function onCheckAuthCode({ kodeId }: { kodeId: string }) {
const res = await fetch(`/api/auth/check?id=${kodeId}`);
const result = await res.json();
@@ -97,37 +93,40 @@ export default function Validasi() {
const result = await res.json();
if (res.status === 200) {
if (res.status === 200 && result.roleId == "1") {
ComponentGlobal_NotifikasiBerhasil(result.message);
localStorage.removeItem("hipmi_auth_code_id");
if (result.roleId === "1") {
ComponentGlobal_NotifikasiBerhasil(result.message);
router.push(RouterHome.main_home, { scroll: false });
// if (result.active === true) {
// } else {
// ComponentGlobal_NotifikasiBerhasil(result.message);
// router.push("/waiting-room", { scroll: false });
// }
} else {
ComponentGlobal_NotifikasiBerhasil("Admin Logged in");
router.push(RouterAdminDashboard.splash_admin, { scroll: false });
}
await auth_funDeleteAktivasiKodeOtpByNomor({
nomor: data.nomor,
});
router.push(RouterHome.main_home, { scroll: false });
return;
}
if (res.status === 200 && result.roleId != "1") {
ComponentGlobal_NotifikasiBerhasil("Admin Logged in");
localStorage.removeItem("hipmi_auth_code_id");
await auth_funDeleteAktivasiKodeOtpByNomor({
nomor: data.nomor,
});
router.push(RouterAdminDashboard.splash_admin, { scroll: false });
return;
}
if (res.status === 404) {
ComponentGlobal_NotifikasiBerhasil(result.message);
router.push("/register", { scroll: false });
ComponentGlobal_NotifikasiBerhasil(result.message);
return;
}
if (res.status === 400) {
ComponentGlobal_NotifikasiPeringatan(result.message);
return;
}
} catch (error) {
console.error(error);
} finally {
setLoading(false);
}
}