aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/index.tsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/index.tsx b/src/index.tsx
index f28aff8..4e2a0b7 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -58,13 +58,12 @@ const App: React.FC = () => {
name,
password
}).then(response => {
- const user = response.data.undefined; // TODO: rename 'undefined' field
- const { accessToken } = response.data;
-
- setUser(user);
- localStorage.setItem('userId', user._id);
- localStorage.setItem('token', accessToken);
- navigate('profile', user._id);
+ const me = response.data.user;
+ const token = response.data.accessToken;
+ setUser(me);
+ localStorage.setItem('userId', me._id);
+ localStorage.setItem('token', token);
+ navigate('profile', me._id);
return true;
}).catch(error => false);
};