refactor: consolidate shared catalog and API helpers

This commit is contained in:
2026-08-02 05:30:02 +02:00
parent 972c681650
commit 3c4bcc28f1
3 changed files with 29 additions and 29 deletions
+13
View File
@@ -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`);