Skip to content

Commit 242d795

Browse files
committed
fix: useMutation missing custom api fetcher
1 parent 0c14f47 commit 242d795

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.changeset/cuddly-bobcats-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ts-rest/react-query': patch
3+
---
4+
5+
Fix custom api not being used on useMutation

libs/ts-rest/react-query/src/lib/ts-rest-client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ const getRouteUseMutation = <TAppRoute extends AppRoute>(
251251
route
252252
);
253253

254-
const result = await defaultApi({
254+
const apiFetcher = clientArgs.api || defaultApi;
255+
256+
const result = await apiFetcher({
255257
path: completeUrl,
256258
method: route.method,
257259
headers: {

0 commit comments

Comments
 (0)