Files
filebrowser/frontend/src/api/settings.js
T

17 lines
334 B
JavaScript
Raw Normal View History

2021-03-21 12:51:58 +01:00
import { fetchURL, fetchJSON } from "./utils";
2019-01-05 16:12:09 +00:00
2021-03-21 12:51:58 +01:00
export function get() {
return fetchJSON(`/api/settings`, {});
2019-01-05 16:12:09 +00:00
}
2021-03-21 12:51:58 +01:00
export async function update(settings) {
2019-01-05 16:12:09 +00:00
const res = await fetchURL(`/api/settings`, {
2021-03-21 12:51:58 +01:00
method: "PUT",
body: JSON.stringify(settings),
});
2019-01-05 16:12:09 +00:00
if (res.status !== 200) {
2021-03-21 12:51:58 +01:00
throw new Error(res.status);
2019-01-05 16:12:09 +00:00
}
}