Files
speckle-server/packages/frontend-2/plugins/dev.ts
T
Kristaps Fabians Geikins 30fdc71fcd fix(fe2 & fe1): log out on invalid auth token on any GQL call (#1666)
* fix(fe2): log out on invalid auth token on any GQL call

* fix(fe1): redirecting to login page on any 403 GQL req

* WIP invalid token

* stricter toker invalidation checks in FE1

* stricter token check in FE2 as well
2023-07-03 15:04:57 +03:00

17 lines
507 B
TypeScript

import { useAuthCookie } from '~~/lib/auth/composables/auth'
export default defineNuxtPlugin(() => {
if (!process.dev) return
if (!process.client) return
console.debug('🚧 Running FE2 in dev mode, extra debugging tools may be available...')
const authToken = useAuthCookie()
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
window.AUTH_TOKEN = {
set: (newVal?: string) => (authToken.value = newVal || undefined),
get: () => authToken.value
}
})