add user test successful and pager scroll to start
This commit is contained in:
parent
9ca7b15ae1
commit
0dc3ca930d
@ -14,6 +14,7 @@ import RegisterWithEmail from './pages/auth/RegisterWithEmail';
|
|||||||
import KeyCloakService from './services/KeyCloakService';
|
import KeyCloakService from './services/KeyCloakService';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import LoggedBar from './components/elements/LoggedBar';
|
import LoggedBar from './components/elements/LoggedBar';
|
||||||
|
import addUser from './api/addUser';
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [loggedBarVisible, setLoggedBarVisible] = React.useState('100vw');
|
const [loggedBarVisible, setLoggedBarVisible] = React.useState('100vw');
|
||||||
@ -21,8 +22,10 @@ const App = () => {
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (sessionStorage.getItem('logged') !== 'yes') {
|
if (sessionStorage.getItem('logged') !== 'yes') {
|
||||||
if (KeyCloakService.isLoggedIn())
|
if (KeyCloakService.isLoggedIn()) {
|
||||||
sessionStorage.setItem('logged', 'yes');
|
sessionStorage.setItem('logged', 'yes');
|
||||||
|
addUser();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
15
src/api/addUser.js
Normal file
15
src/api/addUser.js
Normal file
@ -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;
|
@ -52,10 +52,10 @@ const RightArrow = styled(Svg)`
|
|||||||
const Pager = (props) => {
|
const Pager = (props) => {
|
||||||
return (
|
return (
|
||||||
<PagerStyle>
|
<PagerStyle>
|
||||||
<LeftArrow as='button' src={polygon} onClick={props.previousPage} size='cover'
|
<LeftArrow as='a' href='#start' src={polygon} onClick={props.previousPage} size='cover'
|
||||||
backgroundColor={(props.pageNr === 1) ? 'transparent' : theme.colors.dark}/>
|
backgroundColor={(props.pageNr === 1) ? 'transparent' : theme.colors.dark}/>
|
||||||
<CircleNumber number={props.number} width={props.width} borderRadius={props.borderRadius}/>
|
<CircleNumber number={props.number} width={props.width} borderRadius={props.borderRadius}/>
|
||||||
<RightArrow as='button' src={polygon} onClick={props.nextPage} size='cover'
|
<RightArrow as='a' href='#start' src={polygon} onClick={props.nextPage} size='cover'
|
||||||
backgroundColor={(props.pageNr === props.pages)
|
backgroundColor={(props.pageNr === props.pages)
|
||||||
? 'transparent' : theme.colors.dark}/>
|
? 'transparent' : theme.colors.dark}/>
|
||||||
</PagerStyle>
|
</PagerStyle>
|
||||||
|
@ -97,8 +97,8 @@ const Challenges = () => {
|
|||||||
{renderChallenges()}
|
{renderChallenges()}
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)}
|
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)} width='48px'
|
||||||
nextPage={nextPage} previousPage={previousPage} width='48px' borderRadius='64px'
|
nextPage={nextPage} previousPage={previousPage} borderRadius='64px'
|
||||||
number={`${pageNr} / ${CALC_PAGES(challenges)}`}/> : ''}
|
number={`${pageNr} / ${CALC_PAGES(challenges)}`}/> : ''}
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
</>
|
</>
|
||||||
@ -112,7 +112,7 @@ const Challenges = () => {
|
|||||||
sortByHandler={sortByHandler} statusHandler={statusHandler}
|
sortByHandler={sortByHandler} statusHandler={statusHandler}
|
||||||
challengeTypeHandler={challengeTypeHandler} commercialHandler={commercialHandler}
|
challengeTypeHandler={challengeTypeHandler} commercialHandler={commercialHandler}
|
||||||
sortBy={sortBy} status={status} challengeType={challengeType} commercial={commercial}/>
|
sortBy={sortBy} status={status} challengeType={challengeType} commercial={commercial}/>
|
||||||
<FlexColumn as='main' alignmentY='flex-start' width='100%'
|
<FlexColumn as='main' alignmentY='flex-start' width='100%' id='start'
|
||||||
minHeight='100vh' padding='112px 0 82px 310px'>
|
minHeight='100vh' padding='112px 0 82px 310px'>
|
||||||
<FlexColumn alignmentX='flex-start' width='80%'>
|
<FlexColumn alignmentX='flex-start' width='80%'>
|
||||||
<FlexRow width='100%' gap='32px'>
|
<FlexRow width='100%' gap='32px'>
|
||||||
@ -133,8 +133,8 @@ const Challenges = () => {
|
|||||||
{renderChallenges()}
|
{renderChallenges()}
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)}
|
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)} borderRadius='64px'
|
||||||
nextPage={nextPage} previousPage={previousPage} width='72px' borderRadius='64px'
|
nextPage={nextPage} previousPage={previousPage} width='72px'
|
||||||
number={`${pageNr} / ${CALC_PAGES(challenges)}`}/> : ''}
|
number={`${pageNr} / ${CALC_PAGES(challenges)}`}/> : ''}
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user