Modify users#info endpoint to send username (#426)

This commit is contained in:
Justin Edmund 2025-02-13 05:42:00 -08:00 committed by GitHub
parent 0e7aeed5d6
commit 156f4222d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -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)
}