feat(webui): show current vault mode in setup
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
parent
587917fb3f
commit
58b90e1650
|
@ -4,28 +4,23 @@
|
|||
import { i18n } from "../i18n";
|
||||
import { useNavigate } from "svelte-navigator";
|
||||
import api from "../lib/api";
|
||||
import type { VaultBlobMode } from "@upnd/upend/api";
|
||||
import { onMount } from "svelte";
|
||||
const navigate = useNavigate();
|
||||
|
||||
let mode: "Flat" | "DepthFirst" | "Mirror" | "Incoming" = undefined;
|
||||
let mode: VaultBlobMode = undefined;
|
||||
|
||||
async function submitOptions() {
|
||||
const blob_mode = {};
|
||||
blob_mode[mode] = null;
|
||||
|
||||
const optionResponse = await fetch("/api/options", {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ blob_mode }),
|
||||
});
|
||||
if (!optionResponse.ok) {
|
||||
throw new Error("Failed to set options");
|
||||
}
|
||||
await api.setVaultOptions({ blob_mode: mode });
|
||||
await api.refreshVault();
|
||||
navigate("/");
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
const options = await api.getVaultOptions();
|
||||
mode = options.blob_mode;
|
||||
});
|
||||
|
||||
updateTitle("Initial Setup");
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue