Skip to content

Commit

Permalink
Merge pull request #317 from Do-Good-Get-Good/use-enum-instead-of-const
Browse files Browse the repository at this point in the history
Use enum instead of const
  • Loading branch information
Saanicc authored Sep 18, 2024
2 parents 2a47e3e + 3865a4d commit aa786df
Show file tree
Hide file tree
Showing 4 changed files with 407 additions and 424 deletions.
5 changes: 3 additions & 2 deletions src/context/useUserLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { createContext, PropsWithChildren, useContext, useState } from "react";
import { Role } from "../utility/enums";

type UserLevelContextType = {
userLevel?: Role;
userLevel: Role;
setUserLevel: (role: Role) => void;
};

const UserLevelContext = createContext<UserLevelContextType>({
userLevel: Role.user,
setUserLevel: () => {},
});

Expand All @@ -15,7 +16,7 @@ export const useUserLevel = () => {
};

export const UserLevelProvider = ({ children }: PropsWithChildren) => {
const [userLevel, setUserLevel] = useState<Role | undefined>();
const [userLevel, setUserLevel] = useState<Role>(Role.user);

return (
<UserLevelContext.Provider value={{ userLevel, setUserLevel }}>
Expand Down
7 changes: 0 additions & 7 deletions src/lib/enums/userlevels.js

This file was deleted.

Loading

0 comments on commit aa786df

Please sign in to comment.