mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-28 16:54:04 +08:00
parent
293a7868e2
commit
ebd19f0a56
1 changed files with 18 additions and 22 deletions
|
@ -119,29 +119,25 @@ $("#apeKeysPopup .generateApeKey").on("click", () => {
|
|||
hide();
|
||||
});
|
||||
|
||||
$("#popups #apeKeysPopup").on("click", "table .keyButtons .button", () => {
|
||||
$("#popups").on("click", "#apeKeysPopup table .keyButtons .button", () => {
|
||||
hide();
|
||||
});
|
||||
|
||||
$("#popups #apeKeysPopup").on(
|
||||
"click",
|
||||
"#apeKeysPopup table .textButton",
|
||||
async (e) => {
|
||||
const keyId = $(e.target).closest("tr").attr("keyId") as string;
|
||||
const key = apeKeys?.[keyId];
|
||||
if (!key || !apeKeys) return;
|
||||
Loader.show();
|
||||
const response = await Ape.apeKeys.update(keyId, { enabled: !key.enabled });
|
||||
Loader.hide();
|
||||
if (response.status !== 200) {
|
||||
return Notifications.add("Failed to update key: " + response.message, -1);
|
||||
}
|
||||
apeKeys[keyId].enabled = !key.enabled;
|
||||
refreshList();
|
||||
if (key.enabled) {
|
||||
Notifications.add("Key active", 1);
|
||||
} else {
|
||||
Notifications.add("Key inactive", 1);
|
||||
}
|
||||
$("#popups").on("click", "#apeKeysPopup table .textButton", async (e) => {
|
||||
const keyId = $(e.target).closest("tr").attr("keyId") as string;
|
||||
const key = apeKeys?.[keyId];
|
||||
if (!key || !apeKeys) return;
|
||||
Loader.show();
|
||||
const response = await Ape.apeKeys.update(keyId, { enabled: !key.enabled });
|
||||
Loader.hide();
|
||||
if (response.status !== 200) {
|
||||
return Notifications.add("Failed to update key: " + response.message, -1);
|
||||
}
|
||||
);
|
||||
apeKeys[keyId].enabled = !key.enabled;
|
||||
refreshList();
|
||||
if (key.enabled) {
|
||||
Notifications.add("Key active", 1);
|
||||
} else {
|
||||
Notifications.add("Key inactive", 1);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue