aboutsummaryrefslogtreecommitdiff
path: root/src/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.tsx')
-rw-r--r--src/index.tsx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/index.tsx b/src/index.tsx
index 1362544..0855038 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import {
createMuiTheme,
@@ -15,6 +15,7 @@ import ProfileInfo from './ProfileInfo/ProfileInfo';
import SignInForm from './Form/SignInForm';
import { User } from './types';
+import { get } from './requests';
const theme = createMuiTheme({
palette: {
@@ -37,6 +38,15 @@ const App: React.FC = () => {
const [user, setUser] = React.useState<User | undefined>();
const classes = useStyles();
+ useEffect(() => {
+ const userId = localStorage.getItem('userId');
+ if (userId) {
+ get(`/users/${userId}`).then(response => {
+ setUser(response.data);
+ });
+ }
+ }, []);
+
return (
<ThemeProvider theme={theme}>
<CssBaseline />