mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
feat: adding background jobs ui page and apis - requires user is_admin to be set to true
This commit is contained in:
21
ui/src/auth/logout.ts
Normal file
21
ui/src/auth/logout.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { authStore } from "@/auth/store.ts"
|
||||
import type { DtoLogoutRequest } from "@/sdk"
|
||||
import { makeAuthApi } from "@/sdkClient.ts"
|
||||
|
||||
export async function logoutEverywhere(): Promise<void> {
|
||||
const tokens = authStore.get()
|
||||
|
||||
if (!tokens?.refresh_token) {
|
||||
authStore.logout()
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const body: DtoLogoutRequest = { refresh_token: tokens.refresh_token } as DtoLogoutRequest
|
||||
await makeAuthApi().logout({ body })
|
||||
} catch (err) {
|
||||
console.warn("Logout API failed; clearing local state anyway", err)
|
||||
} finally {
|
||||
authStore.logout()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user