Don't attempt to enrich a user object whenever the role is PUBLIC to avoid 403s
This commit is contained in:
parent
07ea6469fd
commit
bdf7b6257a
|
@ -24,7 +24,12 @@ export const logIn = async ({ email, password }) => {
|
||||||
export const fetchSelf = async () => {
|
export const fetchSelf = async () => {
|
||||||
const user = await API.get({ url: "/api/self" })
|
const user = await API.get({ url: "/api/self" })
|
||||||
if (user?._id) {
|
if (user?._id) {
|
||||||
|
if (user.roleId === "PUBLIC") {
|
||||||
|
// Don't try to enrich a public user as it will 403
|
||||||
|
return user
|
||||||
|
} else {
|
||||||
return (await enrichRows([user], TableNames.USERS))[0]
|
return (await enrichRows([user], TableNames.USERS))[0]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue