nuxt-alt / auth

An alternative module to @nuxtjs/auth
https://nuxt-alt-auth.vercel.app/
MIT License
94 stars 20 forks source link

Calling clearNuxtState throws error #87

Closed ttonyh closed 6 months ago

ttonyh commented 6 months ago

Environment


Nuxt Config

-

Reproduction

-

Describe the bug

Using Nuxt's clearNuxtState method returns an error:

storage.mjs:124 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'loggedIn')
    at storage.mjs:124:40
    at callWithErrorHandling (runtime-core.esm-bundler.js:158:32)
    at getter (runtime-core.esm-bundler.js:1769:22)
    at ReactiveEffect.getter [as fn] (runtime-core.esm-bundler.js:1792:29)
    at ReactiveEffect.run (reactivity.esm-bundler.js:178:19)
    at job (runtime-core.esm-bundler.js:1826:31)
    at flushPreFlushCbs (runtime-core.esm-bundler.js:309:7)
    at updateComponentPreRender (runtime-core.esm-bundler.js:5916:5)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5834:11)
    at ReactiveEffect.run (reactivity.esm-bundler.js:178:19)

Additional context

Part of my logout sequence, I call useAuth().reset(), then clearNuxtData() & clearNuxtState(). clearNuxtState is what causes this issue here:

image

https://github.com/nuxt-alt/auth/blob/946768b6ed825fda2962b2093037824234b98b6f/src/runtime/core/storage.ts#L161

Logs

No response