({children})
| 8 | }; |
| 9 | |
| 10 | const 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 | |
| 35 | export default UserProtectedRoute; |
nothing calls this directly
no outgoing calls
no test coverage detected