generated from ctc-uci/npo-frontend-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set student view and updated role permissions (#47)
Co-authored-by: Ethan Ho <[email protected]> Co-authored-by: ThatMegamind <[email protected]>
- Loading branch information
1 parent
035081f
commit 2a1a57f
Showing
7 changed files
with
129 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* eslint-disable react/jsx-no-constructed-context-values */ | ||
import { createContext, useState, useContext } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const AuthContext = createContext({ | ||
currentUser: null, | ||
setCurrentUser: () => {}, | ||
}); | ||
|
||
const useAuthContext = () => { | ||
return useContext(AuthContext); | ||
}; | ||
|
||
const AuthContextProvider = ({ children }) => { | ||
const [currentUser, setCurrentUser] = useState(null); | ||
return ( | ||
<AuthContext.Provider value={{ currentUser, setCurrentUser }}>{children}</AuthContext.Provider> | ||
); | ||
}; | ||
|
||
AuthContextProvider.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
export { useAuthContext, AuthContextProvider }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Sample roles, feel free to change | ||
const AUTH_ROLES = { | ||
ADMIN_ROLE: 'superadmin', | ||
USER_ROLE: 'admin', | ||
ADMIN_ROLE: 'admin', | ||
USER_ROLE: 'student', | ||
}; | ||
|
||
export default { AUTH_ROLES }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters