Skip to content

Commit

Permalink
cma config check in adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
shafeeqd959 committed Aug 16, 2024
1 parent 9e7d300 commit 7216afb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/contentstack-variants/src/utils/adapter-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class AdapterHelper<C, ApiClient> implements AdapterHelperInterface<C, Ap
public readonly config: C;
public readonly $t: typeof $t;
public readonly apiClient: ApiClient;
public readonly cmaAPIClient: ApiClient;
public readonly cmaAPIClient?: ApiClient;
public readonly messages: typeof messages;

constructor(public readonly adapterConfig: APIConfig, options?: HttpClientOptions) {
Expand All @@ -28,7 +28,9 @@ export class AdapterHelper<C, ApiClient> implements AdapterHelperInterface<C, Ap
'responseType',
];
this.apiClient = new HttpClient(pick(adapterConfig, pickConfig), options) as ApiClient;
this.cmaAPIClient = new HttpClient(pick(adapterConfig.cmaConfig, pickConfig), options) as ApiClient;
if (adapterConfig.cmaConfig) {
this.cmaAPIClient = new HttpClient(pick(adapterConfig.cmaConfig, pickConfig), options) as ApiClient;
}
}

/**
Expand Down

0 comments on commit 7216afb

Please sign in to comment.