move "become superuser" action into the debug menu
This commit is contained in:
parent
4c9e321167
commit
5ea8cc62cd
1 changed files with 12 additions and 10 deletions
|
@ -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");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -99,7 +102,6 @@
|
|||
<AtSignIcon />
|
||||
<span class="h5 top-bar-heading">{ $userInfoStore ? $userInfoStore.username : "" }</span>
|
||||
<div class="account-buttons">
|
||||
<button class="button button-red" on:click="{ doSuperuserPrompt }">Become Superuser</button>
|
||||
<button class="button button-red" on:click="{ doLogout }">Log Out</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue