Moving all images to assets

This commit is contained in:
MaxOvs19
2023-05-25 16:42:37 +03:00
parent 0667b435ac
commit 38f776019c
219 changed files with 2255 additions and 1954 deletions

View File

@ -1,23 +1,30 @@
import React from 'react';
import { useSelector } from 'react-redux'
import { Route, Redirect } from 'react-router-dom';
import { selectAuth } from '../../redux/outstaffingSlice';
import React from "react";
import { useSelector } from "react-redux";
import { Route, Redirect } from "react-router-dom";
import { selectAuth } from "../../redux/outstaffingSlice";
export const ProtectedRoute = ({ component: Component, ...rest }) => {
const isAuth = useSelector(selectAuth)
const existingToken = localStorage.getItem('auth_token')
const expiresAt = localStorage.getItem('access_token_expired_at')
const isAuth = useSelector(selectAuth);
const existingToken = localStorage.getItem("auth_token");
const expiresAt = localStorage.getItem("access_token_expired_at");
const isTokenAlive = !isAuth && (existingToken && expiresAt && new Date(expiresAt).getTime() > (new Date()).getTime());
const isTokenAlive =
!isAuth &&
existingToken &&
expiresAt &&
new Date(expiresAt).getTime() > new Date().getTime();
return (
<Route
{...rest}
render={props =>
// ( isAuth || isTokenAlive) ? (
<Component {...props} />
// ) : <Redirect to='/auth' />
}
/>
);
};
return (
<Route
{...rest}
render={
(props) => (
// ( isAuth || isTokenAlive) ? (
<Component {...props} />
)
// ) : <Redirect to='/auth' />
}
/>
);
};