diff --git a/components/auth/LoginModal/index.tsx b/components/auth/LoginModal/index.tsx index 16ffa62f..21288f3a 100644 --- a/components/auth/LoginModal/index.tsx +++ b/components/auth/LoginModal/index.tsx @@ -111,9 +111,9 @@ const LoginModal = (props: Props) => { .login(body) .then((response) => { storeCookieInfo(response) - return response.data.user.id + return response.data.user.username }) - .then((id) => fetchUserInfo(id)) + .then((username) => fetchUserInfo(username)) .then((infoResponse) => storeUserInfo(infoResponse)) .catch((error: Error | AxiosError) => { if (axios.isAxiosError(error)) { @@ -131,8 +131,8 @@ const LoginModal = (props: Props) => { } } - function fetchUserInfo(id: string) { - return api.userInfo(id) + function fetchUserInfo(username: string) { + return api.userInfo(username) } function storeCookieInfo(response: AxiosResponse) { diff --git a/components/auth/SignupModal/index.tsx b/components/auth/SignupModal/index.tsx index d9c62279..2ee36e1d 100644 --- a/components/auth/SignupModal/index.tsx +++ b/components/auth/SignupModal/index.tsx @@ -85,9 +85,9 @@ const SignupModal = (props: Props) => { .create(body) .then((response) => { storeCookieInfo(response) - return response.data.id + return response.data.username }) - .then((id) => fetchUserInfo(id)) + .then((username) => fetchUserInfo(username)) .then((infoResponse) => storeUserInfo(infoResponse)) } @@ -109,8 +109,8 @@ const SignupModal = (props: Props) => { setHeaders() } - function fetchUserInfo(id: string) { - return api.userInfo(id) + function fetchUserInfo(username: string) { + return api.userInfo(username) } function storeUserInfo(response: AxiosResponse) { diff --git a/utils/api.tsx b/utils/api.tsx index 8508e197..dbc2d437 100644 --- a/utils/api.tsx +++ b/utils/api.tsx @@ -199,8 +199,8 @@ class Api { }) } - userInfo(id: string) { - const resourceUrl = `${this.url}/users/info/${id}` + userInfo(username: string) { + const resourceUrl = `${this.url}/users/info/${username}` return axios.get(resourceUrl) }