From 644cf2a3583d805a9b8a38ba3cf098a9da54bb00 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Sat, 7 Jun 2025 01:33:21 +0200 Subject: [PATCH] feat: email verify APIs --- web/src/api/verify.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 web/src/api/verify.ts diff --git a/web/src/api/verify.ts b/web/src/api/verify.ts new file mode 100644 index 0000000..edaf892 --- /dev/null +++ b/web/src/api/verify.ts @@ -0,0 +1,25 @@ +import { axios, handleApiError } from "."; + +export const requestEmailOtpApi = async (): Promise => { + const response = await axios.post("/api/v1/auth/email"); + + if (response.status !== 200 && response.status !== 201) + throw await handleApiError(response); + + return response.data; +}; + +export interface ConfirmEmailRequest { + otp: string; +} + +export const confirmEmailApi = async ( + req: ConfirmEmailRequest, +): Promise => { + const response = await axios.post("/api/v1/auth/email/otp", req); + + if (response.status !== 200 && response.status !== 201) + throw await handleApiError(response); + + return response.data; +};