From a30557327dcf6463627c1e58229a65e72c9bbec8 Mon Sep 17 00:00:00 2001 From: kurpfish Date: Wed, 4 Aug 2021 16:49:33 +0300 Subject: [PATCH] auth page reload fix --- src/App.js | 18 +++++++----------- src/components/Auth/AuthForDevelopers.js | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/App.js b/src/App.js index 73aa3273..0c071871 100644 --- a/src/App.js +++ b/src/App.js @@ -4,20 +4,17 @@ import 'bootstrap/dist/css/bootstrap.min.css' import './fonts/stylesheet.css' import { ProtectedRoute } from './components/ProtectedRoute/ProtectedRoute'; -const AuthPageForDevelopers = lazy(() => - import('./pages/AuthPageForDevelopers') -) -const AuthPageForPartners = lazy(() => import('./pages/AuthPageForPartners')) -const HomePage = lazy(() => import('./pages/HomePage')) -const CandidatePage = lazy(() => import('./pages/CandidatePage')) -const CalendarPage = lazy(() => import('./pages/CalendarPage')) -const ReportPage = lazy(() => import('./pages/ReportFormPage.js')) -const FormPage = lazy(() => import('./pages/FormPage.js')) +import AuthPageForDevelopers from './pages/AuthPageForDevelopers'; +import AuthPageForPartners from './pages/AuthPageForPartners'; +import HomePage from './pages/HomePage'; +import CandidatePage from './pages/CandidatePage'; +import CalendarPage from'./pages/CalendarPage'; +import ReportPage from './pages/ReportFormPage.js'; +import FormPage from './pages/FormPage.js'; const App = () => { return ( - Loading...}> {/* */} @@ -32,7 +29,6 @@ const App = () => {
Page not found
-
) } diff --git a/src/components/Auth/AuthForDevelopers.js b/src/components/Auth/AuthForDevelopers.js index 5b37bcbd..908ca6be 100644 --- a/src/components/Auth/AuthForDevelopers.js +++ b/src/components/Auth/AuthForDevelopers.js @@ -14,12 +14,23 @@ import vector from '../../images/Vector_Smart_Object.png' import vectorBlack from '../../images/Vector_Smart_Object_black.png' import { fetchAuth } from '../../server/server' +import { useSelector } from 'react-redux' +import { selectAuth } from '../../redux/outstaffingSlice'; +import { Redirect } from 'react-router-dom'; + const AuthForDevelopers = () => { const dispatch = useDispatch() + const isAuth = useSelector(selectAuth) const [username, setUsername] = useState('') const [password, setPassword] = useState('') + console.log('i', isAuth) + + if(isAuth) { + return + } + return (
@@ -57,14 +68,14 @@ const AuthForDevelopers = () => {