MCPcopy Index your code
hub / github.com/komodorio/helm-dashboard / fetchWithSafeDefaults

Method fetchWithSafeDefaults

frontend/src/API/apiService.ts:57–78  ·  view source on GitHub ↗
({
    url,
    options,
    fallback,
  }: {
    url: string;
    options?: RequestInit;
    fallback: T;
  })

Source from the content-addressed store, hash-verified

55 }
56
57 public async fetchWithSafeDefaults<T>({
58 url,
59 options,
60 fallback,
61 }: {
62 url: string;
63 options?: RequestInit;
64 fallback: T;
65 }): Promise<T> {
66 const data = await this.fetchWithDefaults<T>(url, options);
67 if (!data) {
68 console.error(url, " response is empty");
69 return fallback;
70 }
71
72 if (typeof data === "string") {
73 console.error(url, " response is string");
74 return fallback;
75 }
76
77 return data;
78 }
79
80 getToolVersion = async () => {
81 return await this.fetchWithDefaults("/status");

Callers 13

InstallRepoChartModalFunction · 0.80
useGetKubectlContextsFunction · 0.80
useGetK8sResourceFunction · 0.80
useGetK8sResourceListFunction · 0.80
useGetRepositoriesFunction · 0.80
useGetDiscoveredScannersFunction · 0.80
useScanManifestsFunction · 0.80
useScanK8sResourceFunction · 0.80
useGetInstalledReleasesFunction · 0.80
useGetImagesFunction · 0.80
useGetRelationsFunction · 0.80
useGetResourcesFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected