From 8df1465c738ec1eb8e820f2dc5609d98c6f384d8 Mon Sep 17 00:00:00 2001 From: Christian Segovia Date: Sun, 25 Aug 2024 11:07:09 -0500 Subject: [PATCH] enh(#880): add signInHeaders param to SignIn (#881) Co-authored-by: Zoey --- src/runtime/composables/local/useAuth.ts | 5 +++-- src/runtime/types.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime/composables/local/useAuth.ts b/src/runtime/composables/local/useAuth.ts index 6d9b8a9f..1368fe0d 100644 --- a/src/runtime/composables/local/useAuth.ts +++ b/src/runtime/composables/local/useAuth.ts @@ -14,7 +14,7 @@ import { navigateTo, nextTick, useNuxtApp, useRuntimeConfig } from '#imports' type Credentials = { username?: string, email?: string, password?: string } & Record -const signIn: SignInFunc = async (credentials, signInOptions, signInParams) => { +const signIn: SignInFunc = async (credentials, signInOptions, signInParams, signInHeaders) => { const nuxt = useNuxtApp() const runtimeConfig = await callWithNuxt(nuxt, useRuntimeConfig) @@ -23,7 +23,8 @@ const signIn: SignInFunc = async (credentials, signInOptions, const response = await _fetch>(nuxt, path, { method, body: credentials, - params: signInParams ?? {} + params: signInParams ?? {}, + headers: signInHeaders ?? {} }) const { rawToken, rawRefreshToken } = useAuthState() diff --git a/src/runtime/types.ts b/src/runtime/types.ts index 10b79cf7..17152cec 100644 --- a/src/runtime/types.ts +++ b/src/runtime/types.ts @@ -583,7 +583,8 @@ export type SignOutFunc = (options?: SignOutOptions) => Promise export type SignInFunc = ( primaryOptions: PrimarySignInOptions, signInOptions?: SecondarySignInOptions, - paramsOptions?: Record + paramsOptions?: Record, + headersOptions?: Record ) => Promise export interface ModuleOptionsNormalized extends ModuleOptions {