mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 17:59:28 +08:00
clear systems from memory on logout (#970)
This commit is contained in:
@@ -3,7 +3,15 @@ import { toast } from "@/components/ui/use-toast"
|
|||||||
import { type ClassValue, clsx } from "clsx"
|
import { type ClassValue, clsx } from "clsx"
|
||||||
import { twMerge } from "tailwind-merge"
|
import { twMerge } from "tailwind-merge"
|
||||||
import { $alerts, $copyContent, $systems, $userSettings, pb } from "./stores"
|
import { $alerts, $copyContent, $systems, $userSettings, pb } from "./stores"
|
||||||
import { AlertInfo, AlertRecord, ChartTimeData, ChartTimes, FingerprintRecord, SystemRecord } from "@/types"
|
import {
|
||||||
|
AlertInfo,
|
||||||
|
AlertRecord,
|
||||||
|
ChartTimeData,
|
||||||
|
ChartTimes,
|
||||||
|
FingerprintRecord,
|
||||||
|
SystemRecord,
|
||||||
|
UserSettings,
|
||||||
|
} from "@/types"
|
||||||
import { RecordModel, RecordSubscription } from "pocketbase"
|
import { RecordModel, RecordSubscription } from "pocketbase"
|
||||||
import { WritableAtom } from "nanostores"
|
import { WritableAtom } from "nanostores"
|
||||||
import { timeDay, timeHour } from "d3-time"
|
import { timeDay, timeHour } from "d3-time"
|
||||||
@@ -74,7 +82,10 @@ export const updateSystemList = (() => {
|
|||||||
|
|
||||||
/** Logs the user out by clearing the auth store and unsubscribing from realtime updates. */
|
/** Logs the user out by clearing the auth store and unsubscribing from realtime updates. */
|
||||||
export async function logOut() {
|
export async function logOut() {
|
||||||
sessionStorage.setItem("lo", "t")
|
$systems.set([])
|
||||||
|
$alerts.set([])
|
||||||
|
$userSettings.set({} as UserSettings)
|
||||||
|
sessionStorage.setItem("lo", "t") // prevent auto login on logout
|
||||||
pb.authStore.clear()
|
pb.authStore.clear()
|
||||||
pb.realtime.unsubscribe()
|
pb.realtime.unsubscribe()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user