mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-01 21:28:23 +00:00
feat: integrate backend mobile login and enhance user verification flow
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 6m44s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 6m44s
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
import { signUpFormSchema } from "@/lib/schemas";
|
||||
import { backendRegister, checkIdOrPhone } from "@/queries/authentication";
|
||||
import { tryCatch } from "@/utils/tryCatch";
|
||||
import { handleApiResponse, tryCatch } from "@/utils/tryCatch";
|
||||
import { redirect } from "next/navigation";
|
||||
import { z } from "zod";
|
||||
const formSchema = z.object({
|
||||
@ -11,7 +11,7 @@ const formSchema = z.object({
|
||||
.regex(/^[7|9][0-9]{2}-[0-9]{4}$/, "Please enter a valid phone number"),
|
||||
});
|
||||
|
||||
type FilterUserResponse = {
|
||||
export type FilterUserResponse = {
|
||||
ok: boolean;
|
||||
verified: boolean;
|
||||
};
|
||||
@ -184,3 +184,19 @@ export const sendOtp = async (phoneNumber: string, code: string) => {
|
||||
console.log(data);
|
||||
return data;
|
||||
};
|
||||
|
||||
export async function backendMobileLogin({ mobile }: { mobile: string }) {
|
||||
const response = await fetch(
|
||||
`${process.env.SARLINK_API_BASE_URL}/auth/mobile/`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
mobile,
|
||||
}),
|
||||
},
|
||||
);
|
||||
return handleApiResponse<{ detail: string }>(response, "backendMobileLogin");
|
||||
}
|
||||
|
Reference in New Issue
Block a user