-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* UI fixed * progress bar update * UI fixed * Status Update * 🔥 Admin Login Update --------- Co-authored-by: ishara <160392609+ish-2000@users.noreply.github.com>
- Loading branch information
Showing
12 changed files
with
93 additions
and
79 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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import { Navigate, Outlet } from 'react-router-dom' | ||
import { Navigate, Outlet } from 'react-router-dom'; | ||
|
||
const StaffPrivateRoute = () => { | ||
// Check if user is authenticated (e.g., by checking for a token in local storage) | ||
const staff = localStorage.getItem('staffToken') // Replace with your actual logic | ||
const StaffPrivateRoute = ({ manager }) => { // Destructure manager from props | ||
// Check if the user is authenticated by checking for a token in local storage | ||
const staff = localStorage.getItem('staffToken'); // Replace with your actual logic | ||
|
||
// Log the user state for debugging | ||
console.log(staff) | ||
console.log(staff); | ||
|
||
return staff ? <Outlet /> : <Navigate to="/Admin" replace /> | ||
} | ||
// If staff token exists and manager prop is true, redirect to /manager | ||
if (manager) { | ||
return staff ? <Outlet /> : <Navigate to="/manager" replace />; | ||
} | ||
|
||
export default StaffPrivateRoute | ||
// If staff token exists, render the Outlet, otherwise navigate to /Admin | ||
return staff ? <Outlet /> : <Navigate to="/Admin" replace />; | ||
}; | ||
|
||
export default StaffPrivateRoute; |
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
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
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