2024-08-08 17:47:46 +08:00

39 lines
914 B
TypeScript

declare type UserRole = 'root' | 'ro' | 'fo' | 'staff'
declare type UserProfile = {
id: string | number;
token: string;
email: string;
username: string;
department: string;
exp: number;
expiration_time: string;
iat: number;
iss: string;
nbf: number;
type: string;
role: UserRole;
origin_role?: UserRole;
}
declare interface AuthProps {
isLoggedIn: boolean;
isInitialized?: boolean;
user?: UserProfile | null;
token?: string | null;
}
declare type AuthContextType = {
isLoggedIn: boolean;
isInitialized?: boolean;
user?: UserProfile | null | undefined;
logout: () => Promise<void>;
mockLogin: () => Promise<void>;
login: (code:string,state:string) => Promise<void>;
updateUser: (user:Partial<UserProfile>) => Promise<void>;
};
declare type PermissionUserList = {
role_name:string;
username_list: string[];
}