deskripsi:
- api login , validasi, hapus code otp
This commit is contained in:
2025-02-05 10:35:33 +08:00
parent 46d49992b4
commit 7c04d85134
18 changed files with 442 additions and 300 deletions

View File

@@ -1,4 +1,9 @@
export { apiFetchLogin };
export {
apiFetchLogin,
apiGetCheckCodeOtp,
apiPostVerifikasiCodeOtp,
apiDeleteAktivasiKodeOtpByNomor,
};
const apiFetchLogin = async ({ nomor }: { nomor: string }) => {
const respone = await fetch("/api/auth/login", {
@@ -11,3 +16,33 @@ const apiFetchLogin = async ({ nomor }: { nomor: string }) => {
return await respone.json().catch(() => null);
};
const apiGetCheckCodeOtp = async ({ id }: { id: string }) => {
const respone = await fetch(`/api/auth/check/${id}`);
return await respone.json().catch(() => null);
};
const apiPostVerifikasiCodeOtp = async ({ nomor }: { nomor: string }) => {
const respone = await fetch("/api/auth/validasi", {
method: "POST",
body: JSON.stringify({ nomor: nomor }),
headers: {
"Content-Type": "application/json",
},
});
return await respone.json().catch(() => null);
};
const apiDeleteAktivasiKodeOtpByNomor = async ({
nomor,
}: {
nomor: string;
}) => {
const respone = await fetch(`/api/auth/delete/${nomor}`, {
method: "DELETE",
});
return await respone.json().catch(() => null);
};