finish branch
This commit is contained in:
parent
66bc4c5a45
commit
40ca82bb45
11 changed files with 139 additions and 128 deletions
|
|
@ -28,7 +28,6 @@ interface AuthContextType {
|
|||
register: (email: string, password: string) => Promise<void>;
|
||||
logout: () => Promise<void>;
|
||||
hasPermission: (permission: PermissionType) => boolean;
|
||||
hasAnyPermission: (...permissions: PermissionType[]) => boolean;
|
||||
hasRole: (role: string) => boolean;
|
||||
}
|
||||
|
||||
|
|
@ -104,10 +103,6 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|||
return user?.permissions.includes(permission) ?? false;
|
||||
}, [user]);
|
||||
|
||||
const hasAnyPermission = useCallback((...permissions: PermissionType[]): boolean => {
|
||||
return permissions.some((p) => user?.permissions.includes(p) ?? false);
|
||||
}, [user]);
|
||||
|
||||
const hasRole = useCallback((role: string): boolean => {
|
||||
return user?.roles.includes(role) ?? false;
|
||||
}, [user]);
|
||||
|
|
@ -121,7 +116,6 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|||
register,
|
||||
logout,
|
||||
hasPermission,
|
||||
hasAnyPermission,
|
||||
hasRole,
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue