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 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(() => {
|
||||
|
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) => {
|
||||
return (
|
||||
<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}/>
|
||||
<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)
|
||||
? 'transparent' : theme.colors.dark}/>
|
||||
</PagerStyle>
|
||||
|
@ -97,8 +97,8 @@ const Challenges = () => {
|
||||
{renderChallenges()}
|
||||
</FlexColumn>
|
||||
</FlexColumn>
|
||||
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)}
|
||||
nextPage={nextPage} previousPage={previousPage} width='48px' borderRadius='64px'
|
||||
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)} width='48px'
|
||||
nextPage={nextPage} previousPage={previousPage} borderRadius='64px'
|
||||
number={`${pageNr} / ${CALC_PAGES(challenges)}`}/> : ''}
|
||||
</FlexColumn>
|
||||
</>
|
||||
@ -112,7 +112,7 @@ const Challenges = () => {
|
||||
sortByHandler={sortByHandler} statusHandler={statusHandler}
|
||||
challengeTypeHandler={challengeTypeHandler} commercialHandler={commercialHandler}
|
||||
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'>
|
||||
<FlexColumn alignmentX='flex-start' width='80%'>
|
||||
<FlexRow width='100%' gap='32px'>
|
||||
@ -133,8 +133,8 @@ const Challenges = () => {
|
||||
{renderChallenges()}
|
||||
</FlexColumn>
|
||||
</FlexColumn>
|
||||
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)}
|
||||
nextPage={nextPage} previousPage={previousPage} width='72px' borderRadius='64px'
|
||||
{!loading ? <Pager pageNr={pageNr} pages={CALC_PAGES(challenges)} borderRadius='64px'
|
||||
nextPage={nextPage} previousPage={previousPage} width='72px'
|
||||
number={`${pageNr} / ${CALC_PAGES(challenges)}`}/> : ''}
|
||||
</FlexColumn>
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user