Skip to content

Commit

Permalink
feat: add client options to useSanctum login
Browse files Browse the repository at this point in the history
  • Loading branch information
hkp22 committed Nov 2, 2024
1 parent ce5198e commit 48ddc12
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/composables/useSanctum.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -27,6 +28,7 @@ export const useSanctum = <T>() => {

async function login(
credentials: Record<string, any>,
clientOptions: FetchOptions = {},
callback?: (user: T | null) => any,
) {
const { redirect, authMode, sanctumEndpoints } = options;
Expand Down Expand Up @@ -54,6 +56,7 @@ export const useSanctum = <T>() => {
>(sanctumEndpoints.login, {
method: 'post',
body: credentials,
...(clientOptions as object),
});

// Handle token or cookie auth
Expand Down

0 comments on commit 48ddc12

Please sign in to comment.