This commit is contained in:
Anna 2022-09-07 02:18:12 -04:00
parent 8fc555e5de
commit 54fa2f5585
1 changed files with 32 additions and 0 deletions

View File

@ -46,6 +46,7 @@ internal class Settings : ITab {
}
this.ExtraCodeInput();
this.DeleteAccountButton();
ImGui.PopTextWrapPos();
}
@ -80,4 +81,35 @@ internal class Settings : ITab {
}
});
}
private void DeleteAccountButton() {
var ctrl = ImGui.GetIO().KeyCtrl;
if (!ctrl) {
ImGui.BeginDisabled();
}
if (ImGui.Button("Delete account")) {
Task.Run(async () => {
var resp = await ServerHelper.SendRequest(
this.Plugin.Config.ApiKey,
HttpMethod.Delete,
"/account"
);
if (resp.IsSuccessStatusCode) {
this.Plugin.Config.ApiKey = string.Empty;
this.Plugin.SaveConfig();
}
});
}
if (!ctrl) {
ImGui.EndDisabled();
}
ImGui.SameLine();
ImGuiExt.HelpIcon("Hold Ctrl to enable delete button.");
ImGui.TextUnformatted("This will delete all your messages and votes.");
}
}