add prettier
This commit is contained in:
1 parent
6a9a45a4cc
commit
07fc6c0b6c
35 files changed
+530
-461
No files matched your search
+13
-12
@@ -1,17 +1,18 @@
|
||||
import {useMemo} from 'react';
|
||||
import {useAppSelector} from './redux.ts';
|
||||
import {PermissionKeys} from '../types/roles.type.ts';
|
||||
import { useMemo } from 'react'
|
||||
|
||||
import { PermissionKeys } from '../types/roles.type.ts'
|
||||
import { useAppSelector } from './redux.ts'
|
||||
|
||||
export const useRole = () => {
|
||||
const {profile} = useAppSelector((state: any) => state.profileReducer);
|
||||
const role: string = useMemo(() => profile && profile.role, [profile]);
|
||||
const { profile } = useAppSelector((state: any) => state.profileReducer)
|
||||
const role: string = useMemo(() => profile && profile.role, [profile])
|
||||
|
||||
const hasPermission = (permission: PermissionKeys) => {
|
||||
const userPermission = profile.permissions || [];
|
||||
return userPermission.includes(permission);
|
||||
};
|
||||
const hasPermission = (permission: PermissionKeys) => {
|
||||
const userPermission = profile.permissions || []
|
||||
return userPermission.includes(permission)
|
||||
}
|
||||
|
||||
return {role, hasPermission};
|
||||
};
|
||||
return { role, hasPermission }
|
||||
}
|
||||
|
||||
export default useRole;
|
||||
export default useRole
|
||||
Reference in new issue
Block a user