From 48ddc12972c7aa6253379d724b3381d09f3f9c52 Mon Sep 17 00:00:00 2001 From: Harish Kumar Date: Sat, 2 Nov 2024 23:15:43 +0530 Subject: [PATCH] feat: add client options to useSanctum login --- src/runtime/composables/useSanctum.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/composables/useSanctum.ts b/src/runtime/composables/useSanctum.ts index a6496c6..cc89573 100644 --- a/src/runtime/composables/useSanctum.ts +++ b/src/runtime/composables/useSanctum.ts @@ -1,4 +1,5 @@ import { computed } from 'vue'; +import type { FetchOptions } from 'ofetch'; import { getAuthUser } from '../helpers/get-auth-user'; import { extractNestedValue } from '../helpers/utilities'; import { useSanctumFetch } from './useSanctumFetch'; @@ -27,6 +28,7 @@ export const useSanctum = () => { async function login( credentials: Record, + clientOptions: FetchOptions = {}, callback?: (user: T | null) => any, ) { const { redirect, authMode, sanctumEndpoints } = options; @@ -54,6 +56,7 @@ export const useSanctum = () => { >(sanctumEndpoints.login, { method: 'post', body: credentials, + ...(clientOptions as object), }); // Handle token or cookie auth