Skip to content

Commit

Permalink
Merge branch 'main' into feat-local-cookies-options
Browse files Browse the repository at this point in the history
  • Loading branch information
zoey-kaiser authored Nov 16, 2023
2 parents 0669c3a + 64e9001 commit deace67
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/content/2.configuration/2.nuxt-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
8 changes: 6 additions & 2 deletions src/runtime/composables/local/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit deace67

Please sign in to comment.