diff --git a/docs/content/2.configuration/2.nuxt-config.md b/docs/content/2.configuration/2.nuxt-config.md index 242b26ac..d79cba6d 100644 --- a/docs/content/2.configuration/2.nuxt-config.md +++ b/docs/content/2.configuration/2.nuxt-config.md @@ -138,11 +138,11 @@ type ProviderLocal = { */ signIn?: { path?: string, method?: RouterMethod }, /** - * What method and path to call to perform the sign-out. + * What method and path to call to perform the sign-out. Set to false to disable. * * @default { path: '/logout', method: 'post' } */ - signOut?: { path?: string, method?: RouterMethod }, + signOut?: { path?: string, method?: RouterMethod } | false, /** * What method and path to call to perform the sign-up. * diff --git a/src/runtime/composables/local/useAuth.ts b/src/runtime/composables/local/useAuth.ts index 7d2a3ebd..7f838eef 100644 --- a/src/runtime/composables/local/useAuth.ts +++ b/src/runtime/composables/local/useAuth.ts @@ -70,9 +70,13 @@ const signOut: SignOutFunc = async (signOutOptions) => { data.value = null rawToken.value = null - const { path, method } = config.endpoints.signOut + const signOutConfig = config.endpoints.signOut + let res - const res = await _fetch(nuxt, path, { method, headers }) + if (signOutConfig) { + const { path, method } = signOutConfig + res = await _fetch(nuxt, path, { method, headers }) + } const { callbackUrl, redirect = true, external } = signOutOptions ?? {} if (redirect) { diff --git a/src/runtime/types.ts b/src/runtime/types.ts index 12f3aab5..e72dc7c2 100644 --- a/src/runtime/types.ts +++ b/src/runtime/types.ts @@ -74,11 +74,11 @@ type ProviderLocal = { */ signIn?: { path?: string, method?: RouterMethod }, /** - * What method and path to call to perform the sign-out. + * What method and path to call to perform the sign-out. Set to false to disable. * * @default { path: '/logout', method: 'post' } */ - signOut?: { path?: string, method?: RouterMethod }, + signOut?: { path?: string, method?: RouterMethod } | false, /** * What method and path to call to perform the sign-up. *