Skip to content
Snippets Groups Projects
AuthContext.tsx 414 B
Newer Older
Defendi Alberto's avatar
Defendi Alberto committed
import { Roles } from 'api/userRoles';
import { createContext } from 'react';

export type AuthData = {
  role: string;
  isAuth: boolean | null;
  setRole: (role: string) => void;
  setIsAuth: (state: boolean | null) => void;
};

export const AuthContext = createContext<AuthData>({
Defendi Alberto's avatar
Defendi Alberto committed
  role: Roles.visitor,
  isAuth: false,
  setRole: () => {
    // Do nothing
  },
  setIsAuth: () => {
    // Do nothing
  },