diff --git a/src/runtime/composables/refresh/useAuth.ts b/src/runtime/composables/refresh/useAuth.ts index 2c72f68d..4b18666a 100644 --- a/src/runtime/composables/refresh/useAuth.ts +++ b/src/runtime/composables/refresh/useAuth.ts @@ -152,22 +152,26 @@ const signOut: SignOutFunc = async (signOutOptions) => { rawToken.value = null rawRefreshToken.value = null - const { path, method } = config.endpoints.signOut as { - path: string; - method: - | 'get' - | 'head' - | 'patch' - | 'post' - | 'put' - | 'delete' - | 'connect' - | 'options' - | 'trace'; + const signOutConfig = config.endpoints.signOut + let res + + if (signOutConfig) { + const { path, method } = config.endpoints.signOut as { + path: string; + method: + | 'get' + | 'head' + | 'patch' + | 'post' + | 'put' + | 'delete' + | 'connect' + | 'options' + | 'trace'; + } + res = await _fetch(nuxt, path, { method, headers }) } - const res = await _fetch(nuxt, path, { method, headers }) - const { callbackUrl, redirect = true } = signOutOptions ?? {} if (redirect) { await navigateTo(callbackUrl ?? (await getRequestURLWN(nuxt)))