refresh auth status if no systems are found

This commit is contained in:
Henry Dollman
2024-08-07 15:07:22 -04:00
parent 2eb691661c
commit 876fb6e02e

View File

@@ -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<SystemRecord>('systems').getFullList({ sort: '+name' })
// try {
const records = await pb.collection<SystemRecord>('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 = () => {