fix API
deskripsi: - api login , validasi, hapus code otp
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user