mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-06-29 13:43:58 +00:00
refactor: migrate authentication and signup flow to use external API and improve type safety
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m58s
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m58s
This commit is contained in:
31
lib/backend-types.ts
Normal file
31
lib/backend-types.ts
Normal file
@ -0,0 +1,31 @@
|
||||
export interface Links {
|
||||
next_page: string | null;
|
||||
previous_page: string | null;
|
||||
}
|
||||
export interface Meta {
|
||||
total: number;
|
||||
per_page: number;
|
||||
current_page: number;
|
||||
last_page: number;
|
||||
}
|
||||
|
||||
export interface DataResponse<T> {
|
||||
meta: Meta;
|
||||
links: Links;
|
||||
data: T[];
|
||||
}
|
||||
|
||||
export interface Atoll {
|
||||
id: number;
|
||||
islands: Island[];
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface Island {
|
||||
id: number;
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
@ -5,10 +5,10 @@ export const signUpFormSchema = z.object({
|
||||
.string()
|
||||
.min(2, { message: "ID Card is required" })
|
||||
.regex(/^[A][0-9]{6}$/, "Please enter a valid ID Card number."),
|
||||
atoll_id: z.string().min(2, { message: "Atoll is required." }),
|
||||
atoll_id: z.string().min(1, { message: "Atoll is required." }),
|
||||
island_id: z
|
||||
.string({ required_error: "Island is required." })
|
||||
.min(2, { message: "Island is required." }),
|
||||
.min(1, { message: "Island is required." }),
|
||||
address: z.string().min(2, { message: "address is required." }),
|
||||
dob: z.coerce.date({ message: "Date of birth is required." }),
|
||||
phone_number: z
|
||||
@ -26,5 +26,8 @@ export const signUpFormSchema = z.object({
|
||||
required_error: "You must accept the privacy policy",
|
||||
})
|
||||
.transform((val) => val === "on"),
|
||||
accNo: z.string().min(2, { message: "Account number is required." }),
|
||||
accNo: z
|
||||
.string()
|
||||
.min(2, { message: "Account number is required." })
|
||||
.regex(/^(7\d{12}|9\d{16})$/, "Please enter a valid account number"),
|
||||
});
|
||||
|
Reference in New Issue
Block a user