import { APIOptions, handleRestFailures, UserSettings, isModArchResponse, restGET, } from 'mod-arch-core'; import { BFF_API_VERSION, URL_PREFIX } from '~/app/utilities/const'; import { NamespaceKind } from '~/app/types'; export const getUser = (hostPath: string) => (opts: APIOptions): Promise => handleRestFailures( restGET(hostPath, `${URL_PREFIX}/api/${BFF_API_VERSION}/user`, {}, opts), ).then((response) => { if (isModArchResponse(response)) { return response.data; } throw new Error('Invalid response format'); }); export const getNamespaces = (hostPath: string) => (opts: APIOptions): Promise => handleRestFailures( restGET(hostPath, `${URL_PREFIX}/api/${BFF_API_VERSION}/namespaces`, {}, opts), ).then((response) => { if (isModArchResponse(response)) { return response.data; } throw new Error('Invalid response format'); });