This commit is contained in:
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user