fix registrasi

deskripsi:
- fix registrasi dan middleware
This commit is contained in:
2025-02-05 17:48:45 +08:00
parent d7252b9fb3
commit 61f8e03c73
10 changed files with 199 additions and 173 deletions

View File

@@ -3,6 +3,7 @@ export {
apiGetCheckCodeOtp,
apiPostVerifikasiCodeOtp,
apiDeleteAktivasiKodeOtpByNomor,
apiFetchRegister,
};
const apiFetchLogin = async ({ nomor }: { nomor: string }) => {
@@ -43,7 +44,30 @@ const apiDeleteAktivasiKodeOtpByNomor = async ({ id }: { id: string }) => {
},
});
console.log("respone delete", await respone.json());
return await respone.json().catch(() => null);
};
const apiFetchRegister = async ({
nomor,
username,
}: {
nomor: string;
username: string;
}) => {
const data = {
username: username,
nomor: nomor,
};
const respone = await fetch("/api/auth/register", {
method: "POST",
body: JSON.stringify({ data }),
headers: {
"Content-Type": "application/json",
},
});
const result = await respone.json();
return result;
// return await respone.json().catch(() => null);
};