diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-14 01:31:05 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-14 01:31:05 +0300 |
commit | 3969face39ecc933b1cb9c7625be921d148552cb (patch) | |
tree | 6c1ebc773767bf0637ae6b568997033479d0e597 /src/index.tsx | |
parent | 57a2ff3cfa7eae111bb8f46447198586c47425fb (diff) | |
download | which-ui-3969face39ecc933b1cb9c7625be921d148552cb.tar.gz |
feat: add sing in form
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> |