generated from UoaWDCC/react-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from UoaWDCC/VOL-138/Enum-Context
Enums, and dir structure, template code
- Loading branch information
Showing
7 changed files
with
36 additions
and
1 deletion.
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,5 @@ | ||
import React from "react"; | ||
|
||
const AuthenticationContext = React.createContext(null); | ||
|
||
export default AuthenticationContext; |
Empty file.
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,6 @@ | ||
const AccessLevel = { | ||
USER: "user", | ||
STAFF: "staff", | ||
}; | ||
|
||
export default AccessLevel; |
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,4 @@ | ||
// Set up staff protected routes #129 | ||
// https://github.com/orgs/UoaWDCC/projects/33?pane=issue&itemId=69456673 | ||
|
||
|
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,20 @@ | ||
// Complete in Issue | ||
|
||
import { useState } from "react"; | ||
|
||
function StaffAuth() { | ||
|
||
const [isStaff, setAsStaff] = useState(false); | ||
|
||
function checkIfStaff(email: string) { | ||
const splitEmail = email.split("@"); | ||
const emailDomain = splitEmail[1]; | ||
|
||
return emailDomain === "auckland.ac.nz"; // Add check for specific volunteering admin email | ||
} | ||
|
||
|
||
return isStaff; | ||
} | ||
|
||
export default StaffAuth; |
File renamed without changes.