mirror of https://github.com/buster-so/buster.git
fail anon user check
This commit is contained in:
parent
1ca1e9c736
commit
a29048815e
|
@ -10,10 +10,15 @@ export const getMyUserInfo = async ({
|
|||
jwtToken: string | undefined;
|
||||
}): Promise<BusterUserResponse | undefined> => {
|
||||
if (!jwtToken) {
|
||||
const res = await serverFetch<BusterUserResponse>(`/users`, {
|
||||
method: 'GET'
|
||||
});
|
||||
return res;
|
||||
try {
|
||||
//If Anonymous user, it will fail, so we catch the error and return undefined
|
||||
const res = await serverFetch<BusterUserResponse>(`/users`, {
|
||||
method: 'GET'
|
||||
});
|
||||
return res;
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
//use fetch instead of serverFetch because...
|
||||
|
|
Loading…
Reference in New Issue