Skip to content

Commit

Permalink
Update frontend to handle google refresh error id, and also add a che…
Browse files Browse the repository at this point in the history
…ck to our 401 to ensure it's a invalid token exception before shipping the user off to login.
  • Loading branch information
MelissaAutumn committed Jan 17, 2024
1 parent 16021ac commit 742c68f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const call = createFetch({
async onFetchError({ data, response, error }) {
// Catch any google refresh error that may occur
if (
data?.detail?.error === 'google_refresh_error'
&& !siteNotificationStore.isSameNotification('google_refresh_error')
data?.detail?.id === 'GOOGLE_REFRESH_ERROR'
&& !siteNotificationStore.isSameNotification('GOOGLE_REFRESH_ERROR')
) {
// Ensure other async calls don't reach here
siteNotificationStore.lock(data.detail.error);
Expand All @@ -82,7 +82,7 @@ const call = createFetch({
data.detail?.message || 'Please re-connect with Google',
url,
);
} else if (response.status === 401) {
} else if (response.status === 401 && data?.detail?.id === 'INVALID_TOKEN') {
// Clear current user data, and ship them to the login screen!
await currentUser.reset();
await router.push('/login');
Expand Down

0 comments on commit 742c68f

Please sign in to comment.