test: expand authenticated admin workflows
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-10 02:01:00 -04:00
parent 4f0e3d89f6
commit fce30513d4
5 changed files with 56 additions and 2 deletions
+9 -1
View File
@@ -33,7 +33,15 @@ async function save() {
message.value = '';
error.value = '';
try {
Object.assign(settings, await updateAdminSettings(settings, csrfToken()));
const payload = {
...settings,
general: {
...settings.general,
publicContactEmail: settings.general.publicContactEmail || undefined,
publicContactPhone: settings.general.publicContactPhone || undefined,
},
};
Object.assign(settings, await updateAdminSettings(payload, csrfToken()));
message.value = 'Settings saved.';
} catch (requestError) {
error.value = requestError.message;
@@ -4,7 +4,10 @@ async function request(path, options = {}) {
const response = await fetch(`${apiBaseUrl}${path}`, {
credentials: 'include',
...options,
headers: { 'content-type': 'application/json', ...options.headers },
headers: {
...(options.body ? { 'content-type': 'application/json' } : {}),
...options.headers,
},
});
const payload = await response.json().catch(() => null);
if (!response.ok) throw new Error(payload?.error?.message ?? 'Saved view request failed.');