From 700a4d653c60642baffe2fa781b2ffaa8a401e6b Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Thu, 22 Dec 2022 01:36:32 -0800 Subject: [PATCH] Tentatively fix Login and Signup There's probably more here, but I can at least log in right now --- components/LoginModal/index.tsx | 14 +++++++------- components/SignupModal/index.tsx | 13 +++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/components/LoginModal/index.tsx b/components/LoginModal/index.tsx index a1c501a2..fc38928f 100644 --- a/components/LoginModal/index.tsx +++ b/components/LoginModal/index.tsx @@ -99,7 +99,7 @@ const LoginModal = (props: Props) => { .login(body) .then((response) => { storeCookieInfo(response) - return response.data.user.id + return response.data.id }) .then((id) => fetchUserInfo(id)) .then((infoResponse) => storeUserInfo(infoResponse)) @@ -111,7 +111,7 @@ const LoginModal = (props: Props) => { } function storeCookieInfo(response: AxiosResponse) { - const user = response.data.user + const user = response.data const cookieObj: AccountCookie = { userId: user.id, @@ -123,11 +123,11 @@ const LoginModal = (props: Props) => { } function storeUserInfo(response: AxiosResponse) { - const user = response.data.user + const user = response.data const cookieObj: UserCookie = { - picture: user.picture.picture, - element: user.picture.element, + picture: user.avatar.picture, + element: user.avatar.element, language: user.language, gender: user.gender, } @@ -137,8 +137,8 @@ const LoginModal = (props: Props) => { accountState.account.user = { id: user.id, username: user.username, - picture: user.picture.picture, - element: user.picture.element, + picture: user.avatar.picture, + element: user.avatar.element, gender: user.gender, } diff --git a/components/SignupModal/index.tsx b/components/SignupModal/index.tsx index 0610ed49..b7a31379 100644 --- a/components/SignupModal/index.tsx +++ b/components/SignupModal/index.tsx @@ -75,7 +75,7 @@ const SignupModal = (props: Props) => { .create(body) .then((response) => { storeCookieInfo(response) - return response.data.user.user_id + return response.data.user_id }) .then((id) => fetchUserInfo(id)) .then((infoResponse) => storeUserInfo(infoResponse)) @@ -98,11 +98,12 @@ const SignupModal = (props: Props) => { } function storeUserInfo(response: AxiosResponse) { - const user = response.data.user + const user = response.data + console.log(user) const cookieObj: UserCookie = { - picture: user.picture.picture, - element: user.picture.element, + picture: user.avatar.picture, + element: user.avatar.element, language: user.language, gender: user.gender, } @@ -113,8 +114,8 @@ const SignupModal = (props: Props) => { accountState.account.user = { id: user.id, username: user.username, - picture: user.picture.picture, - element: user.picture.element, + picture: user.avatar.picture, + element: user.avatar.element, gender: user.gender, }