Fix event

Deskripsi:
- Fix logika konfirmasi event
- Penambahan tampilan kehadiran peserta di admin
This commit is contained in:
2024-12-09 13:57:40 +08:00
parent 667d90bdad
commit a308f41eb1
8 changed files with 196 additions and 96 deletions

View File

@@ -41,7 +41,7 @@ export default function Register() {
const res = await fetch(`/api/auth/check?id=${kodeId}`);
const result = await res.json();
onSetData(result.data.nomor);
onSetData(result.nomor);
}
async function onRegistarsi() {

View File

@@ -43,7 +43,7 @@ export default function Validasi() {
useShallowEffect(() => {
const kodeId = localStorage.getItem("hipmi_auth_code_id");
if (kodeId != null) {
onCheckAuthCode({ kodeId: kodeId as string, onSetData: setData });
onCheckAuthCode({ kodeId: kodeId as string });
} else {
console.log("code id not found");
}
@@ -51,25 +51,23 @@ export default function Validasi() {
if (triggerOtp) {
const kodeId = localStorage.getItem("hipmi_auth_code_id");
if (kodeId != null) {
onCheckAuthCode({ kodeId: kodeId as string, onSetData: setData });
onCheckAuthCode({ kodeId: kodeId as string });
} else {
console.log("code id not found");
}
setTriggerOtp(false);
}
}, [triggerOtp, setData, setTriggerOtp]);
}, [triggerOtp]);
async function onCheckAuthCode({
kodeId,
onSetData,
}: {
kodeId: string;
onSetData: any;
}) {
const res = await fetch(`/api/auth/check?id=${kodeId}`);
const result = await res.json();
onSetData({
setData({
nomor: result.nomor,
code: result.otp,
});