Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/runtime/composables/useSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const getRequestCookies = async (nuxt: NuxtApp): Promise<{ cookie: string } | {}
const navigateToAuthPageWithNuxt = (nuxt: NuxtApp, href: string) => callWithNuxt(nuxt, navigateToAuthPages, [href])
const joinPathToApiURLWithNuxt = (nuxt: NuxtApp, path: string) => callWithNuxt(nuxt, joinPathToApiURL, [path])
const getRequestURLWithNuxt = (nuxt: NuxtApp) => callWithNuxt(nuxt, getRequestURL)
const getCsrfTokenWithNuxt = (nuxt: NuxtApp) => callWithNuxt(nuxt, getCsrfToken)
const getSessionWithNuxt = (nuxt: NuxtApp) => callWithNuxt(nuxt, getSession)

/**
* Get the current Cross-Site Request Forgery token.
Expand Down Expand Up @@ -162,7 +164,7 @@ const signIn = async (

// At this point the request succeeded (i.e., it went through)
const error = new URL(data.url).searchParams.get('error')
await callWithNuxt(nuxt, getSession)
await getSessionWithNuxt(nuxt)

return {
error,
Expand Down Expand Up @@ -247,7 +249,7 @@ const signOut = async (options?: SignOutOptions) => {

const requestURL = await getRequestURLWithNuxt(nuxt)
const { callbackUrl = requestURL, redirect = true } = options ?? {}
const csrfToken = await getCsrfToken()
const csrfToken = await getCsrfTokenWithNuxt(nuxt)

if (!csrfToken) {
throw createError({ statusCode: 400, statusMessage: 'Could not fetch CSRF Token for signing out' })
Expand All @@ -273,7 +275,7 @@ const signOut = async (options?: SignOutOptions) => {
return navigateToAuthPageWithNuxt(nuxt, url)
}

await getSession()
await getSessionWithNuxt(nuxt)
return signoutData
}

Expand Down