Register and OTP (#31)
* feat: responsive * fix: success register * feat: auth login responsive && auth login implementation * fix: login page button disabled & register page * fix: conflict * fix: button disabled when loading * feat: register and otp integration * Update middleware.ts
This commit is contained in:
@@ -34,8 +34,8 @@ export const postVerifyEmail = async (
|
||||
): Promise<TResponseMessage> => {
|
||||
const { data } = await api({
|
||||
method: 'POST',
|
||||
url: '/auth/verify',
|
||||
data: payload,
|
||||
url: '/auth/verify-email',
|
||||
data: {otp: parseInt(payload.otp), email: payload.email},
|
||||
});
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -57,3 +57,12 @@ export const authRegisterSchema = z
|
||||
message: 'Password dan Konfirmasi Password harus sama',
|
||||
path: ['confirm_password'],
|
||||
});
|
||||
|
||||
export const verifyEmailSchema = z
|
||||
.object({
|
||||
otp: z
|
||||
.string({
|
||||
required_error: 'OTP tidak boleh kosong',
|
||||
})
|
||||
.min(6, 'Masukkan kode 6 digit yang dikirimkan ke email')
|
||||
})
|
||||
@@ -20,10 +20,10 @@ export type TRegisterRequest = z.infer<typeof authRegisterSchema>;
|
||||
export type TRegisterResponse = TResponseDetail<TResponseMessage>;
|
||||
|
||||
export type TVerifyOtpRequest = {
|
||||
otp: number;
|
||||
otp: string;
|
||||
};
|
||||
|
||||
export type TVerifyEmailRequest = {
|
||||
email: string;
|
||||
otp: number;
|
||||
otp: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user