fail anon user check

This commit is contained in:
Nate Kelley 2025-02-18 15:30:38 -07:00
parent 1ca1e9c736
commit a29048815e
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 9 additions and 4 deletions

View File

@ -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...