Skip to content

Commit 17a18a9

Browse files
committed
Merge mutation and query options
1 parent db40fe5 commit 17a18a9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/lib/seam/use-seam-mutation.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
1313

1414
export function useSeamMutation<T extends SeamHttpEndpointMutationPaths>(
1515
endpointPath: T,
16-
options?: Parameters<SeamHttpEndpoints[T]>[1],
17-
mutationOptions: MutationOptions<
18-
MutationData<T>,
19-
SeamHttpApiError,
20-
MutationParameters<T>
21-
> = {}
16+
options: Parameters<SeamHttpEndpoints[T]>[1] &
17+
MutationOptions<
18+
MutationData<T>,
19+
SeamHttpApiError,
20+
MutationParameters<T>
21+
> = {}
2222
): UseMutationResult<MutationData<T>, SeamHttpApiError, MutationParameters<T>> {
2323
const { endpointClient: client } = useSeamClient()
2424
return useMutation({
25-
...mutationOptions,
25+
...options,
2626
mutationFn: async (parameters) => {
2727
if (client === null) throw new NullSeamClientError()
2828
// Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.

src/lib/seam/use-seam-query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import { useSeamClient } from 'lib/seam/use-seam-client.js'
1414
export function useSeamQuery<T extends SeamHttpEndpointQueryPaths>(
1515
endpointPath: T,
1616
parameters?: Parameters<SeamHttpEndpoints[T]>[0],
17-
options?: Parameters<SeamHttpEndpoints[T]>[1],
18-
queryOptions: QueryOptions<QueryData<T>, SeamHttpApiError> = {}
17+
options: Parameters<SeamHttpEndpoints[T]>[1] &
18+
QueryOptions<QueryData<T>, SeamHttpApiError> = {}
1919
): UseQueryResult<QueryData<T>, SeamHttpApiError> {
2020
const { endpointClient: client } = useSeamClient()
2121
return useQuery({
2222
enabled: client != null,
23-
...queryOptions,
23+
...options,
2424
queryKey: [endpointPath, parameters],
2525
queryFn: async () => {
2626
if (client == null) return null

0 commit comments

Comments
 (0)