delete
This commit is contained in:
parent
8fc555e5de
commit
54fa2f5585
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue