Unauth users were unable to view collections
This commit is contained in:
parent
ea24777eb7
commit
54d34fed12
2 changed files with 16 additions and 6 deletions
|
|
@ -50,21 +50,26 @@ const ProfileRoute: React.FC = () => {
|
|||
}, [])
|
||||
|
||||
const fetchProfile = useCallback(() => {
|
||||
const filterParams = {
|
||||
const filters = {
|
||||
params: {
|
||||
element: element,
|
||||
raid: raidId,
|
||||
recency: recencyInSeconds
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const headers = {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${cookies.account.access_token}`
|
||||
}
|
||||
}
|
||||
|
||||
const params = (cookies.account) ? {...filters, ...headers} : filters
|
||||
|
||||
setLoading(true)
|
||||
|
||||
if (username)
|
||||
api.endpoints.users.getOne({ id: username as string, params: filterParams })
|
||||
api.endpoints.users.getOne({ id: username as string, params: params })
|
||||
.then(response => {
|
||||
setUser({
|
||||
id: response.data.user.id,
|
||||
|
|
|
|||
|
|
@ -43,20 +43,25 @@ const TeamsRoute: React.FC = () => {
|
|||
}, [])
|
||||
|
||||
const fetchTeams = useCallback(() => {
|
||||
const filterParams = {
|
||||
const filters = {
|
||||
params: {
|
||||
element: element,
|
||||
raid: raidId,
|
||||
recency: recencyInSeconds
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const headers = {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${cookies.account?.access_token}`
|
||||
}
|
||||
}
|
||||
|
||||
const params = (cookies.account) ? {...filters, ...headers} : filters
|
||||
|
||||
setLoading(true)
|
||||
|
||||
api.endpoints.parties.getAll(filterParams)
|
||||
api.endpoints.parties.getAll(params)
|
||||
.then(response => {
|
||||
const parties: Party[] = response.data
|
||||
setParties(parties.map((p: any) => p.party).sort((a, b) => (a.created_at > b.created_at) ? -1 : 1))
|
||||
|
|
|
|||
Loading…
Reference in a new issue