From 876fb6e02eeeab44b9943f7e10d3cf8cf78427b2 Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Wed, 7 Aug 2024 15:07:22 -0400 Subject: [PATCH] refresh auth status if no systems are found --- hub/site/src/lib/utils.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hub/site/src/lib/utils.ts b/hub/site/src/lib/utils.ts index 5bbe988..85d537b 100644 --- a/hub/site/src/lib/utils.ts +++ b/hub/site/src/lib/utils.ts @@ -34,16 +34,27 @@ const verifyAuth = () => { .authRefresh() .catch(() => { pb.authStore.clear() + toast({ + title: 'Failed to authenticate', + description: 'Please log in again', + variant: 'destructive', + }) }) } export const updateSystemList = async () => { - try { - const records = await pb.collection('systems').getFullList({ sort: '+name' }) + // try { + const records = await pb.collection('systems').getFullList({ sort: '+name' }) + if (records.length) { $systems.set(records) - } catch (e) { + } else { verifyAuth() } + // } + // catch (e) { + // console.log('verifying auth error', e) + // verifyAuth() + // } } export const updateAlerts = () => {