feat(settings): add database backup management

This commit is contained in:
Rafael Foster
2026-04-29 14:04:04 -03:00
parent 7e61a83db9
commit 0cbd93e4e0
25 changed files with 816 additions and 33 deletions
+12 -2
View File
@@ -31,16 +31,17 @@ async function apiFetch(path, options = {}, _retried = false) {
const method = options.method ?? 'GET';
const stateChanging = ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);
const { headers: optionHeaders = {}, ...fetchOptions } = options;
const response = await fetch(url, {
credentials: 'same-origin',
cache: 'no-store',
...fetchOptions,
headers: {
'Content-Type': 'application/json',
...(stateChanging ? { 'X-CSRF-Token': getCsrfToken() } : {}),
...options.headers,
...optionHeaders,
},
...options,
});
if (response.status === 401) {
@@ -115,6 +116,15 @@ const api = {
body: JSON.stringify(body),
}),
rawPost: (path, body, headers = {}) => apiFetch(path, {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
...headers,
},
body,
}),
put: (path, body) => apiFetch(path, {
method: 'PUT',
body: JSON.stringify(body),