MCPcopy Create free account
hub / github.com/bsoc-bitbyte/busify / UserProtectedRoute

Function UserProtectedRoute

frontend/src/components/ProtectedRoutes.tsx:10–33  ·  view source on GitHub ↗
({children})

Source from the content-addressed store, hash-verified

8};
9
10const UserProtectedRoute: React.FC<UserProtectedRoutetypes> = ({children}) => {
11 const {isAuth, isloading} = useAuthStore();
12
13 if (isloading) {
14 return (
15 <Box
16 sx={{
17 display: 'flex',
18 justifyContent: 'center',
19 alignItems: 'center',
20 height: '70vh',
21 }}
22 >
23 <CircularProgress size={100} />
24 </Box>
25 );
26 }
27
28 if (!isAuth) {
29 toast.error('You need to login first!');
30 return <Navigate to="/" replace />;
31 }
32 return <>{children}</>;
33};
34
35export default UserProtectedRoute;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected