refactor: consolidate shared catalog and API helpers
This commit is contained in:
@@ -127,6 +127,19 @@ export function apiPostJson<TResponse, TPayload = unknown>(
|
||||
return apiPost<TResponse>(settings, path, { ...init, body: JSON.stringify(payload) });
|
||||
}
|
||||
|
||||
export function apiPatch<TResponse>(settings: ApiSettings, path: string, init: Omit<RequestInit, "method"> = {}): Promise<TResponse> {
|
||||
return apiFetch<TResponse>(settings, path, { ...init, method: "PATCH" });
|
||||
}
|
||||
|
||||
export function apiPatchJson<TResponse, TPayload = unknown>(
|
||||
settings: ApiSettings,
|
||||
path: string,
|
||||
payload: TPayload,
|
||||
init: Omit<RequestInit, "method" | "body"> = {}
|
||||
): Promise<TResponse> {
|
||||
return apiPatch<TResponse>(settings, path, { ...init, body: JSON.stringify(payload) });
|
||||
}
|
||||
|
||||
export function loadApiSettings(): ApiSettings {
|
||||
const storedBaseUrl = loadStoredSetting("baseUrl");
|
||||
const storedApiKey = sessionStorage.getItem(`${SESSION_STORAGE_KEY}.apiKey`);
|
||||
|
||||
Reference in New Issue
Block a user