diff --git a/frontend/src/components/overlays/Settings.svelte b/frontend/src/components/overlays/Settings.svelte index a92c89f..744901d 100644 --- a/frontend/src/components/overlays/Settings.svelte +++ b/frontend/src/components/overlays/Settings.svelte @@ -8,6 +8,15 @@ export let close = () => {}; + const doSuperuserPrompt = async () => { + const { ok } = await request("POST", apiRoute("users/self/promote"), true); + if (ok) { + overlayStore.toast("You have been promoted to superuser"); + } else { + overlayStore.toast("Failed to promote to superuser"); + } + }; + const doDeveloper = () => { overlayStore.push(OverlayType.Prompt, { heading: "", @@ -26,6 +35,9 @@ case "storage.getItem": { return respond(getItem(parts[1])); } + case "_actions.becomeSuperuser": { + return doSuperuserPrompt(); + } default: { return respond("Error: unknown operator"); } @@ -39,15 +51,6 @@ logOut(); overlayStore.toast("Logged out"); }; - - const doSuperuserPrompt = async () => { - const { ok } = await request("POST", apiRoute("users/self/promote"), true); - if (ok) { - overlayStore.toast("You have been promoted to superuser"); - } else { - overlayStore.toast("Failed to promote to superuser"); - } - };