feat: add config preset manager

This commit is contained in:
2026-03-26 22:09:01 +01:00
parent 1dad80e557
commit e8cb877497
11 changed files with 587 additions and 29 deletions

View File

@@ -30,7 +30,14 @@ export async function fetchServerAPI<T>(
if (response.status == 401) {
redirect('/login?expired=true');
}
throw new Error(`API Error: ${response.statusText} - ${method} - ${BASE_URL}${endpoint}`);
let message = response.statusText;
try {
const body = await response.json();
message = body?.error ?? body?.message ?? message;
} catch {
// non-JSON error body, keep statusText
}
throw new Error(message);
}
if (response.headers.get('Content-Type')?.includes('application/json')) {