diff --git a/src/App.js b/src/App.js index 0c071871..b01e7b69 100644 --- a/src/App.js +++ b/src/App.js @@ -16,18 +16,18 @@ const App = () => { return ( - - {/* */} + + + + - -
Page not found
-
+
Page not found
} />
) diff --git a/src/components/Auth/AuthForDevelopers.js b/src/components/Auth/AuthForDevelopers.js index 908ca6be..ce94de8b 100644 --- a/src/components/Auth/AuthForDevelopers.js +++ b/src/components/Auth/AuthForDevelopers.js @@ -25,8 +25,6 @@ const AuthForDevelopers = () => { const [username, setUsername] = useState('') const [password, setPassword] = useState('') - console.log('i', isAuth) - if(isAuth) { return } diff --git a/src/components/Auth/AuthForPartners.js b/src/components/Auth/AuthForPartners.js index 4b79d1dc..20d93134 100644 --- a/src/components/Auth/AuthForPartners.js +++ b/src/components/Auth/AuthForPartners.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { auth } from '../../redux/outstaffingSlice'; import style from './AuthForPartners.module.css'; @@ -12,9 +12,22 @@ import phone from '../../images/phone.png'; import telegram from '../../images/telegram.png'; 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 AuthForPartners = () => { - const dispatch = useDispatch(); + const dispatch = useDispatch() + const isAuth = useSelector(selectAuth) + + const [username, setUsername] = useState('') + const [password, setPassword] = useState('') + + if(isAuth) { + return + } return (
@@ -34,12 +47,27 @@ const AuthForPartners = () => {
- + setUsername(e.target.value)} + /> - + setPassword(e.target.value)} + /> -
diff --git a/src/server/server.js b/src/server/server.js index 634b372e..d1ba75af 100644 --- a/src/server/server.js +++ b/src/server/server.js @@ -3,7 +3,7 @@ export const fetchProfile = async (link, index) => { const response = await fetch(`${link}${index}`, { headers: { 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, - 'Origin': `${baseURL}`, + 'Origin': `${process.env.REACT_APP_BASE_URL}`, } }) let data = await response.json() @@ -17,7 +17,7 @@ export const fetchSkills = async (link) => { const response = await fetch(link, { headers: { 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, - 'Origin': `${baseURL}`, + 'Origin': `${process.env.REACT_APP_BASE_URL}`, } }) let data = await response.json() @@ -31,7 +31,7 @@ export const fetchItemsForId = async (link, id) => { const response = await fetch(`${link}${id}`, { headers: { 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, - 'Origin': `${baseURL}`, + 'Origin': `${process.env.REACT_APP_BASE_URL}`, } }) let data = await response.json() @@ -46,7 +46,7 @@ export const fetchForm = async (link, info) => { method: 'POST', headers: { 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, - 'Origin': `${baseURL}`, + 'Origin': `${process.env.REACT_APP_BASE_URL}`, 'Content-Type': 'multipart/form-data' }, body: info