Skip to content

Commit

Permalink
Simplify management client creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Enngage committed Sep 27, 2024
1 parent c44b51d commit 12e6b23
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/fetch/kontent-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@ interface KontentFetcherConfig {
}

export function kontentFetcher(config: KontentFetcherConfig) {
const getManagementClient = (): GeneratorManagementClient => {
return createManagementClient({
environmentId: config.environmentId,
apiKey: config.apiKey,
baseUrl: config.baseUrl,
httpService: new HttpService({ logErrorsToConsole: false })
});
};

const client = getManagementClient();
const client: GeneratorManagementClient = createManagementClient({
environmentId: config.environmentId,
apiKey: config.apiKey,
baseUrl: config.baseUrl,
httpService: new HttpService({ logErrorsToConsole: false })
});

return {
async getEnvironmentInfoAsync(): Promise<Readonly<EnvironmentModels.EnvironmentInformationModel>> {
Expand Down

0 comments on commit 12e6b23

Please sign in to comment.