diff options
Diffstat (limited to 'src/index.tsx')
-rw-r--r-- | src/index.tsx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/index.tsx b/src/index.tsx index adf44a5..98be8a7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -13,7 +13,8 @@ import Header from './Header/Header'; import Feed from './Feed/Feed'; import ProfileInfo from './ProfileInfo/ProfileInfo'; -import { get } from './requests'; +import SignInForm from './Form/SignInForm'; +import { User } from './types'; const theme = createMuiTheme({ palette: { @@ -33,20 +34,17 @@ const useStyles = makeStyles({ const App: React.FC = () => { const [page, setPage] = useState('feed'); - const [id, setId] = useState<string>(''); + const [user, setUser] = React.useState<User | undefined>(); const classes = useStyles(); - get('/users').then(response => { - setId(response.data[0]._id); - }); - return ( <ThemeProvider theme={theme}> <CssBaseline /> <Header setPage={setPage} /> <div className={classes.root}> { - page === 'profile' && <ProfileInfo id={id} /> + // eslint-disable-next-line + page === 'profile' && (!user ? <SignInForm setUser={setUser} /> : <ProfileInfo id={user?._id || ''} setUser={setUser} />) } <Feed page={page} /> </div> |