Modify users#info endpoint to send username (#426)
This commit is contained in:
parent
0e7aeed5d6
commit
156f4222d7
3 changed files with 10 additions and 10 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue