Skip to content

Commit 64e9001

Browse files
authored
feat: add possibility to disable signOut endpoint for local provider (#572)
1 parent 24c31b8 commit 64e9001

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

docs/content/2.configuration/2.nuxt-config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ type ProviderLocal = {
138138
*/
139139
signIn?: { path?: string, method?: RouterMethod },
140140
/**
141-
* What method and path to call to perform the sign-out.
141+
* What method and path to call to perform the sign-out. Set to false to disable.
142142
*
143143
* @default { path: '/logout', method: 'post' }
144144
*/
145-
signOut?: { path?: string, method?: RouterMethod },
145+
signOut?: { path?: string, method?: RouterMethod } | false,
146146
/**
147147
* What method and path to call to perform the sign-up.
148148
*

src/runtime/composables/local/useAuth.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ const signOut: SignOutFunc = async (signOutOptions) => {
5353
data.value = null
5454
rawToken.value = null
5555

56-
const { path, method } = config.endpoints.signOut
56+
const signOutConfig = config.endpoints.signOut
57+
let res
5758

58-
const res = await _fetch(nuxt, path, { method, headers })
59+
if (signOutConfig) {
60+
const { path, method } = signOutConfig
61+
res = await _fetch(nuxt, path, { method, headers })
62+
}
5963

6064
const { callbackUrl, redirect = true, external } = signOutOptions ?? {}
6165
if (redirect) {

src/runtime/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ type ProviderLocal = {
7474
*/
7575
signIn?: { path?: string, method?: RouterMethod },
7676
/**
77-
* What method and path to call to perform the sign-out.
77+
* What method and path to call to perform the sign-out. Set to false to disable.
7878
*
7979
* @default { path: '/logout', method: 'post' }
8080
*/
81-
signOut?: { path?: string, method?: RouterMethod },
81+
signOut?: { path?: string, method?: RouterMethod } | false,
8282
/**
8383
* What method and path to call to perform the sign-up.
8484
*

0 commit comments

Comments
 (0)