mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 18:56:17 +01:00
auth: ensure realtime subscriptions are cleared on logout
This commit is contained in:
@@ -33,7 +33,7 @@ const verifyAuth = () => {
|
||||
pb.collection("users")
|
||||
.authRefresh()
|
||||
.catch(() => {
|
||||
pb.authStore.clear()
|
||||
logOut()
|
||||
toast({
|
||||
title: t`Failed to authenticate`,
|
||||
description: t`Please log in again`,
|
||||
@@ -65,6 +65,11 @@ export const updateSystemList = (() => {
|
||||
}
|
||||
})()
|
||||
|
||||
/** Logs the user out by clearing the auth store and unsubscribing from realtime updates. */
|
||||
export async function logOut() {
|
||||
pb.authStore.clear()
|
||||
pb.realtime.unsubscribe()
|
||||
}
|
||||
|
||||
export const updateAlerts = () => {
|
||||
pb.collection("alerts")
|
||||
|
||||
Reference in New Issue
Block a user