refactor: resolving PR commets

This refactor includes a change that adds a conditional arg to the ExternalApi get() method to
override the base url. This method was pre-existing and already used in the calls and method.

#943
This commit is contained in:
Hermanus Engelbrecht
2024-08-27 15:27:53 +02:00
parent f5b3b06dfe
commit 0e588bf315
3 changed files with 40 additions and 48 deletions

View File

@@ -47,7 +47,8 @@ class ExternalAPI {
endpoint: string,
params?: Record<string, string>,
ttl?: number,
config?: RequestInit
config?: RequestInit,
overwriteBaseUrl?: string
): Promise<T> {
const cacheKey = this.serializeCacheKey(endpoint, {
...this.params,
@@ -58,7 +59,7 @@ class ExternalAPI {
return cachedItem;
}
const url = this.formatUrl(endpoint, params);
const url = this.formatUrl(endpoint, params, overwriteBaseUrl);
const response = await this.fetch(url, {
...config,
headers: {