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 = () => {};
|
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 = () => {
|
const doDeveloper = () => {
|
||||||
overlayStore.push(OverlayType.Prompt, {
|
overlayStore.push(OverlayType.Prompt, {
|
||||||
heading: "",
|
heading: "",
|
||||||
|
@ -26,6 +35,9 @@
|
||||||
case "storage.getItem": {
|
case "storage.getItem": {
|
||||||
return respond(getItem(parts[1]));
|
return respond(getItem(parts[1]));
|
||||||
}
|
}
|
||||||
|
case "_actions.becomeSuperuser": {
|
||||||
|
return doSuperuserPrompt();
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
return respond("Error: unknown operator");
|
return respond("Error: unknown operator");
|
||||||
}
|
}
|
||||||
|
@ -39,15 +51,6 @@
|
||||||
logOut();
|
logOut();
|
||||||
overlayStore.toast("Logged out");
|
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>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -99,7 +102,6 @@
|
||||||
<AtSignIcon />
|
<AtSignIcon />
|
||||||
<span class="h5 top-bar-heading">{ $userInfoStore ? $userInfoStore.username : "" }</span>
|
<span class="h5 top-bar-heading">{ $userInfoStore ? $userInfoStore.username : "" }</span>
|
||||||
<div class="account-buttons">
|
<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>
|
<button class="button button-red" on:click="{ doLogout }">Log Out</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue