commit
5b42702ce3
18
src/App.js
18
src/App.js
@ -4,20 +4,17 @@ import 'bootstrap/dist/css/bootstrap.min.css'
|
|||||||
import './fonts/stylesheet.css'
|
import './fonts/stylesheet.css'
|
||||||
import { ProtectedRoute } from './components/ProtectedRoute/ProtectedRoute';
|
import { ProtectedRoute } from './components/ProtectedRoute/ProtectedRoute';
|
||||||
|
|
||||||
const AuthPageForDevelopers = lazy(() =>
|
import AuthPageForDevelopers from './pages/AuthPageForDevelopers';
|
||||||
import('./pages/AuthPageForDevelopers')
|
import AuthPageForPartners from './pages/AuthPageForPartners';
|
||||||
)
|
import HomePage from './pages/HomePage';
|
||||||
const AuthPageForPartners = lazy(() => import('./pages/AuthPageForPartners'))
|
import CandidatePage from './pages/CandidatePage';
|
||||||
const HomePage = lazy(() => import('./pages/HomePage'))
|
import CalendarPage from'./pages/CalendarPage';
|
||||||
const CandidatePage = lazy(() => import('./pages/CandidatePage'))
|
import ReportPage from './pages/ReportFormPage.js';
|
||||||
const CalendarPage = lazy(() => import('./pages/CalendarPage'))
|
import FormPage from './pages/FormPage.js';
|
||||||
const ReportPage = lazy(() => import('./pages/ReportFormPage.js'))
|
|
||||||
const FormPage = lazy(() => import('./pages/FormPage.js'))
|
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path='/auth' exact>
|
<Route path='/auth' exact>
|
||||||
{/* <AuthPageForPartners /> */}
|
{/* <AuthPageForPartners /> */}
|
||||||
@ -32,7 +29,6 @@ const App = () => {
|
|||||||
<div>Page not found</div>
|
<div>Page not found</div>
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Suspense>
|
|
||||||
</Router>
|
</Router>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,23 @@ import vector from '../../images/Vector_Smart_Object.png'
|
|||||||
import vectorBlack from '../../images/Vector_Smart_Object_black.png'
|
import vectorBlack from '../../images/Vector_Smart_Object_black.png'
|
||||||
import { fetchAuth } from '../../server/server'
|
import { fetchAuth } from '../../server/server'
|
||||||
|
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
|
import { selectAuth } from '../../redux/outstaffingSlice';
|
||||||
|
import { Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
const AuthForDevelopers = () => {
|
const AuthForDevelopers = () => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
const isAuth = useSelector(selectAuth)
|
||||||
|
|
||||||
const [username, setUsername] = useState('')
|
const [username, setUsername] = useState('')
|
||||||
const [password, setPassword] = useState('')
|
const [password, setPassword] = useState('')
|
||||||
|
|
||||||
|
console.log('i', isAuth)
|
||||||
|
|
||||||
|
if(isAuth) {
|
||||||
|
return <Redirect to='/' />
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={style.developers}>
|
<section className={style.developers}>
|
||||||
<div className={style.developers__background}>
|
<div className={style.developers__background}>
|
||||||
@ -57,14 +68,14 @@ const AuthForDevelopers = () => {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
className={style.form__btn}
|
className={style.form__btn}
|
||||||
type='submit'
|
onClick={(e) => {
|
||||||
onClick={() =>
|
e.preventDefault();
|
||||||
fetchAuth({
|
fetchAuth({
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
dispatch: ()=> dispatch(auth(true))
|
dispatch: ()=> dispatch(auth(true))
|
||||||
})
|
})
|
||||||
}
|
}}
|
||||||
>
|
>
|
||||||
Войти
|
Войти
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user