mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 09:49:28 +08:00
verify auth if error fetching systems
This commit is contained in:
@@ -26,15 +26,23 @@ export async function copyToClipboard(content: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const verifyAuth = () => {
|
||||||
export const updateSystemList = () => {
|
pb.collection('users')
|
||||||
pb.collection<SystemRecord>('systems')
|
.authRefresh()
|
||||||
.getFullList({ sort: '+name' })
|
.catch(() => {
|
||||||
.then((records) => {
|
pb.authStore.clear()
|
||||||
$systems.set(records)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const updateSystemList = async () => {
|
||||||
|
try {
|
||||||
|
const records = await pb.collection<SystemRecord>('systems').getFullList({ sort: '+name' })
|
||||||
|
$systems.set(records)
|
||||||
|
} catch (e) {
|
||||||
|
verifyAuth()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const updateAlerts = () => {
|
export const updateAlerts = () => {
|
||||||
pb.collection('alerts')
|
pb.collection('alerts')
|
||||||
.getFullList<AlertRecord>({ fields: 'id,name,system' })
|
.getFullList<AlertRecord>({ fields: 'id,name,system' })
|
||||||
|
Reference in New Issue
Block a user