diff --git a/src/App.js b/src/App.js index 824b464..d101201 100644 --- a/src/App.js +++ b/src/App.js @@ -14,6 +14,7 @@ import RegisterWithEmail from './pages/auth/RegisterWithEmail'; import KeyCloakService from './services/KeyCloakService'; import React from 'react'; import LoggedBar from './components/elements/LoggedBar'; +import addUser from './api/addUser'; const App = () => { const [loggedBarVisible, setLoggedBarVisible] = React.useState('100vw'); @@ -21,8 +22,10 @@ const App = () => { React.useEffect(() => { if (sessionStorage.getItem('logged') !== 'yes') { - if (KeyCloakService.isLoggedIn()) + if (KeyCloakService.isLoggedIn()) { sessionStorage.setItem('logged', 'yes'); + addUser(); + } } setTimeout(() => { diff --git a/src/api/addUser.js b/src/api/addUser.js new file mode 100644 index 0000000..5da0156 --- /dev/null +++ b/src/api/addUser.js @@ -0,0 +1,15 @@ +import {API} from '../utils/globals'; +import KeyCloakService from '../services/KeyCloakService'; + +const addUser = () => { + fetch(`${API}/add-user`, { + headers: {'Authorization': `Bearer ${KeyCloakService.getToken()}`} + }) + .then(response => response.json()) + .then(data => { + console.log('add user'); + console.log(data); + }); +}; + +export default addUser; \ No newline at end of file diff --git a/src/components/elements/Pager.js b/src/components/elements/Pager.js index 4ba8147..536aca2 100644 --- a/src/components/elements/Pager.js +++ b/src/components/elements/Pager.js @@ -52,10 +52,10 @@ const RightArrow = styled(Svg)` const Pager = (props) => { return ( - - diff --git a/src/pages/Challanges/Challenges.js b/src/pages/Challanges/Challenges.js index 0b843ce..78eb89c 100644 --- a/src/pages/Challanges/Challenges.js +++ b/src/pages/Challanges/Challenges.js @@ -97,8 +97,8 @@ const Challenges = () => { {renderChallenges()} - {!loading ? : ''} @@ -112,7 +112,7 @@ const Challenges = () => { sortByHandler={sortByHandler} statusHandler={statusHandler} challengeTypeHandler={challengeTypeHandler} commercialHandler={commercialHandler} sortBy={sortBy} status={status} challengeType={challengeType} commercial={commercial}/> - @@ -133,8 +133,8 @@ const Challenges = () => { {renderChallenges()} - {!loading ? : ''}