From e7e98d279fe0ee4c71ae72a7b57afdd517a89641 Mon Sep 17 00:00:00 2001 From: Lubos Date: Mon, 15 Jul 2024 14:32:11 +0100 Subject: [PATCH] fix: always use client options when passed to service --- .changeset/sixty-sheep-reply.md | 5 +++++ packages/client-fetch/src/index.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changeset/sixty-sheep-reply.md diff --git a/.changeset/sixty-sheep-reply.md b/.changeset/sixty-sheep-reply.md new file mode 100644 index 000000000..5cadc9172 --- /dev/null +++ b/.changeset/sixty-sheep-reply.md @@ -0,0 +1,5 @@ +--- +'@hey-api/client-fetch': patch +--- + +fix: always use client options when passed to service diff --git a/packages/client-fetch/src/index.ts b/packages/client-fetch/src/index.ts index 1d9fd04eb..476670929 100644 --- a/packages/client-fetch/src/index.ts +++ b/packages/client-fetch/src/index.ts @@ -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 @@ -159,4 +160,8 @@ export const createClient = (config: Config): Client => { }; }; -export const client = createClient(globalConfig); +export const client = createClient({ + ...globalConfig, + // @ts-ignore + root: true, +});