feat: email verify APIs
This commit is contained in:
25
web/src/api/verify.ts
Normal file
25
web/src/api/verify.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { axios, handleApiError } from ".";
|
||||||
|
|
||||||
|
export const requestEmailOtpApi = async (): Promise<void> => {
|
||||||
|
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<void> => {
|
||||||
|
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;
|
||||||
|
};
|
Reference in New Issue
Block a user