diff --git a/src/api/getFullUserInfo.js b/src/api/getFullUserInfo.js new file mode 100644 index 0000000..cb60749 --- /dev/null +++ b/src/api/getFullUserInfo.js @@ -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; \ No newline at end of file diff --git a/src/components/specific_challenge/HowTo/HowTo.js b/src/components/specific_challenge/HowTo/HowTo.js index a8b1678..5ec86ef 100644 --- a/src/components/specific_challenge/HowTo/HowTo.js +++ b/src/components/specific_challenge/HowTo/HowTo.js @@ -1,9 +1,17 @@ import React from 'react'; +import getFullUser from '../../../api/getFullUserInfo'; import { FlexColumn } from '../../../utils/containers'; import { IS_MOBILE } from '../../../utils/globals'; import HowToContent from './sections/HowToContent'; const HowTo = (props) => { + const [userFullInfo, setUserFullInfo] = React.useState(null); + // const [loading, setLoading] = React.useState(true); + + React.useEffect(() => { + getFullUser(setUserFullInfo); + }, []); + return ( { >