aboutsummaryrefslogtreecommitdiff
path: root/src/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.tsx')
-rw-r--r--src/index.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/index.tsx b/src/index.tsx
index b9204b6..f28aff8 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -52,8 +52,8 @@ const App: React.FC = () => {
}
};
- const logIn = (name: string, password: string) => {
- post('/authentication', {
+ const logIn = (name: string, password: string): Promise<boolean> => {
+ return post('/authentication', {
strategy: 'local',
name,
password
@@ -65,7 +65,8 @@ const App: React.FC = () => {
localStorage.setItem('userId', user._id);
localStorage.setItem('token', accessToken);
navigate('profile', user._id);
- });
+ return true;
+ }).catch(error => false);
};
const logOut = () => {
@@ -91,7 +92,7 @@ const App: React.FC = () => {
<div className={classes.root}>
{ page.prefix === 'profile' && <ProfilePage logOut={logOut} id={page.id} navigate={navigate} /> }
{ page.prefix === 'feed' && <FeedPage navigate={navigate} /> }
- { page.prefix === 'auth' && <AuthPage logIn={logIn} navigate={navigate} /> }
+ { page.prefix === 'auth' && <AuthPage logIn={logIn} /> }
</div>
</ThemeProvider>
);