Add Prettier for TypeScript formatting
- Install prettier - Configure .prettierrc.json and .prettierignore - Add npm scripts: format, format:check - Add Makefile target: format-frontend - Format all frontend files
This commit is contained in:
parent
4b394b0698
commit
37de6f70e0
44 changed files with 906 additions and 856 deletions
|
|
@ -25,7 +25,7 @@ export const Permission = {
|
|||
CANCEL_ANY_APPOINTMENT: "cancel_any_appointment",
|
||||
} as const;
|
||||
|
||||
export type PermissionType = typeof Permission[keyof typeof Permission];
|
||||
export type PermissionType = (typeof Permission)[keyof typeof Permission];
|
||||
|
||||
// Use generated type from OpenAPI schema
|
||||
type User = components["schemas"]["UserResponse"];
|
||||
|
|
@ -100,13 +100,19 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|||
setUser(null);
|
||||
};
|
||||
|
||||
const hasPermission = useCallback((permission: PermissionType): boolean => {
|
||||
return user?.permissions.includes(permission) ?? false;
|
||||
}, [user]);
|
||||
const hasPermission = useCallback(
|
||||
(permission: PermissionType): boolean => {
|
||||
return user?.permissions.includes(permission) ?? false;
|
||||
},
|
||||
[user]
|
||||
);
|
||||
|
||||
const hasRole = useCallback((role: string): boolean => {
|
||||
return user?.roles.includes(role) ?? false;
|
||||
}, [user]);
|
||||
const hasRole = useCallback(
|
||||
(role: string): boolean => {
|
||||
return user?.roles.includes(role) ?? false;
|
||||
},
|
||||
[user]
|
||||
);
|
||||
|
||||
return (
|
||||
<AuthContext.Provider
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue