get full user info test
This commit is contained in:
parent
234e4a47f7
commit
66d3c27040
18
src/api/getFullUserInfo.js
Normal file
18
src/api/getFullUserInfo.js
Normal 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;
|
@ -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}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user