Skip to content

Commit

Permalink
fix: always use client options when passed to service
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlubos committed Jul 15, 2024
1 parent b3cab59 commit e7e98d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-sheep-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hey-api/client-fetch': patch
---

fix: always use client options when passed to service
9 changes: 7 additions & 2 deletions packages/client-fetch/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const createClient = (config: Config): Client => {
globalConfig = { ..._config };
}

const getConfig = () => (_config.global ? globalConfig : _config);
// @ts-ignore
const getConfig = () => (_config.root ? globalConfig : _config);

const interceptors = _config.global
? globalInterceptors
Expand Down Expand Up @@ -159,4 +160,8 @@ export const createClient = (config: Config): Client => {
};
};

export const client = createClient(globalConfig);
export const client = createClient({
...globalConfig,
// @ts-ignore
root: true,
});

0 comments on commit e7e98d2

Please sign in to comment.