add project structure

This commit is contained in:
veselovnk committed 2024-04-04 13:54:22 +03:00
1 parent 07fc6c0b6c
commit 6eaf18285a
28 files changed
+1309 -648

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { Navigate, Outlet, useLocation } from 'react-router-dom'
import { localStorageKeys } from '@constants/localStorageKeys.ts'
import { LocalStorage } from '@utils/localStorageUtils.ts'
import { routePaths } from '@routes/routePaths.ts'
const PrivateRoute = () => {
const location = useLocation()
const userToken = LocalStorage.get(localStorageKeys.USER_TOKEN)
if (!userToken) {
LocalStorage.set('redirectUrl', location.pathname)
return <Navigate to={routePaths.login} replace />
}
return <Outlet />
}
export default PrivateRoute