Added roles support

This commit is contained in:
Valentino K 2022-05-17 11:52:08 +02:00
parent 2b00c8425d
commit da9eedc94e
17 changed files with 390 additions and 250 deletions

View file

@ -1,11 +1,12 @@
import { useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { getAuthToken, getCurrentUser, signIn, signOut } from '../redux';
import { getAuthToken, getCurrentUser, getIsAdmin, signIn, signOut } from '../redux';
export function useAuth() {
const dispatch = useDispatch();
const currentUser = useSelector(getCurrentUser);
const authToken = useSelector(getAuthToken);
const isAdmin = useSelector(getIsAdmin);
const logIn = useCallback(
(params) => {
@ -21,6 +22,7 @@ export function useAuth() {
return {
authToken,
currentUser,
isAdmin,
logIn,
logOut,
};