create user pages crud also update pages ui build order and car ,driver first page interfase create model layer to componants
This commit is contained in:
54
types/user.ts
Normal file
54
types/user.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
export interface User {
|
||||
id: string;
|
||||
name: string;
|
||||
userName?: string;
|
||||
email?: string;
|
||||
phone: string;
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
role?: { id?: string; name: string };
|
||||
branch?: { id?: string; name: string };
|
||||
}
|
||||
|
||||
export interface UserFormData {
|
||||
name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
password: string;
|
||||
roleId: string;
|
||||
branchId: string;
|
||||
}
|
||||
|
||||
export interface FormErrors {
|
||||
name?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
password?: string;
|
||||
roleId?: string;
|
||||
branchId?: string;
|
||||
}
|
||||
|
||||
export interface ApiListResponse<T> {
|
||||
data: {
|
||||
data: T[];
|
||||
pagination: { total: number; page: number; pages: number ; };
|
||||
meta?: { total: number; pages: number };
|
||||
};
|
||||
}
|
||||
|
||||
export type TableState = {
|
||||
users: User[];
|
||||
loading: boolean;
|
||||
total: number;
|
||||
pages: number;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
export type TableAction =
|
||||
| { type: "LOAD_START" }
|
||||
| { type: "LOAD_OK"; users: User[]; total: number; pages: number }
|
||||
| { type: "LOAD_ERR"; error: string }
|
||||
| { type: "ADD"; user: User }
|
||||
| { type: "UPDATE"; user: User }
|
||||
| { type: "DELETE"; id: string }
|
||||
| { type: "CLEAR_ERR" };
|
||||
Reference in New Issue
Block a user