30fdc71fcd
* 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
17 lines
507 B
TypeScript
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
|
|
}
|
|
})
|