From 2b78605ac99c8a98245e13c6efa3e0294961227a Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 26 Sep 2020 09:51:03 -0700 Subject: [PATCH] Store access token with cookies --- src/components/LoginModal/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/LoginModal/index.tsx b/src/components/LoginModal/index.tsx index 2d39b4d1..c9b851e3 100644 --- a/src/components/LoginModal/index.tsx +++ b/src/components/LoginModal/index.tsx @@ -89,9 +89,15 @@ const LoginModal = (props: Props) => { if (formValid) { api.login(body) .then((response) => { - console.log(response) const cookies = props.cookies - cookies.set('user', response.data.user, { path: '/'}) + + const cookieObj = { + user_id: response.data.user.id, + username: response.data.user.username, + access_token: response.data.access_token + } + + cookies.set('user', cookieObj, { path: '/'}) props.close() }, (error) => { console.error(error)