Skip to content

Commit

Permalink
enh(#880): add signInHeaders param to SignIn (#881)
Browse files Browse the repository at this point in the history
Co-authored-by: Zoey <[email protected]>
  • Loading branch information
dangercris and zoey-kaiser authored Aug 25, 2024
1 parent 15630ca commit 8df1465
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/runtime/composables/local/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { navigateTo, nextTick, useNuxtApp, useRuntimeConfig } from '#imports'

type Credentials = { username?: string, email?: string, password?: string } & Record<string, any>

const signIn: SignInFunc<Credentials, any> = async (credentials, signInOptions, signInParams) => {
const signIn: SignInFunc<Credentials, any> = async (credentials, signInOptions, signInParams, signInHeaders) => {
const nuxt = useNuxtApp()

const runtimeConfig = await callWithNuxt(nuxt, useRuntimeConfig)
Expand All @@ -23,7 +23,8 @@ const signIn: SignInFunc<Credentials, any> = async (credentials, signInOptions,
const response = await _fetch<Record<string, any>>(nuxt, path, {
method,
body: credentials,
params: signInParams ?? {}
params: signInParams ?? {},
headers: signInHeaders ?? {}
})

const { rawToken, rawRefreshToken } = useAuthState()
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ export type SignOutFunc = (options?: SignOutOptions) => Promise<any>
export type SignInFunc<PrimarySignInOptions, SignInResult> = (
primaryOptions: PrimarySignInOptions,
signInOptions?: SecondarySignInOptions,
paramsOptions?: Record<string, string>
paramsOptions?: Record<string, string>,
headersOptions?: Record<string, string>
) => Promise<SignInResult>

export interface ModuleOptionsNormalized extends ModuleOptions {
Expand Down

0 comments on commit 8df1465

Please sign in to comment.