get full user info test

This commit is contained in:
Mateusz Tylka 2023-02-23 20:53:11 +01:00
parent 234e4a47f7
commit 66d3c27040
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import {API} from '../utils/globals';
import KeyCloakService from '../services/KeyCloakService';
const getFullUser = (setDataState, setLoadingState) => {
fetch(`${API}/full-user-info`, {
headers: {'Authorization': `Bearer ${KeyCloakService.getToken()}`}
})
.then(response => response.json())
.then(data => {
console.log('getFullUser');
console.log(data);
setDataState(data);
if (setLoadingState)
setLoadingState(false);
});
};
export default getFullUser;

View File

@ -1,9 +1,17 @@
import React from 'react'; import React from 'react';
import getFullUser from '../../../api/getFullUserInfo';
import { FlexColumn } from '../../../utils/containers'; import { FlexColumn } from '../../../utils/containers';
import { IS_MOBILE } from '../../../utils/globals'; import { IS_MOBILE } from '../../../utils/globals';
import HowToContent from './sections/HowToContent'; import HowToContent from './sections/HowToContent';
const HowTo = (props) => { const HowTo = (props) => {
const [userFullInfo, setUserFullInfo] = React.useState(null);
// const [loading, setLoading] = React.useState(true);
React.useEffect(() => {
getFullUser(setUserFullInfo);
}, []);
return ( return (
<FlexColumn <FlexColumn
margin={IS_MOBILE() ? null : '64px 0 0 0'} margin={IS_MOBILE() ? null : '64px 0 0 0'}
@ -14,6 +22,7 @@ const HowTo = (props) => {
> >
<FlexColumn maxWidth="680px" alignmentX="flex-start" gap="48px"> <FlexColumn maxWidth="680px" alignmentX="flex-start" gap="48px">
<HowToContent <HowToContent
userFullInfo={userFullInfo}
user={props.user ? props.user : 'yourID'} user={props.user ? props.user : 'yourID'}
challengeName={props.challengeName} challengeName={props.challengeName}
/> />