|
@@ -7,6 +7,7 @@ import {confirmDialog} from "../dialog/confirmDialog";
|
|
|
import {needSubscribe} from "../util/needSubscribe";
|
|
|
import {syncGuide} from "../sync/syncGuide";
|
|
|
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
|
|
+import {getEventName} from "../protyle/util/compatibility";
|
|
|
|
|
|
export const account = {
|
|
|
element: undefined as Element,
|
|
@@ -87,6 +88,10 @@ ${window.siyuan.languages.account8}`;
|
|
|
<button class="b3-button b3-button--cancel" id="logout">
|
|
|
${window.siyuan.languages.logout}
|
|
|
</button>
|
|
|
+ <span class="fn__space"></span>
|
|
|
+ <button class="b3-button b3-button--cancel${window.siyuan.config.system.container === "ios" ? "" : " fn__none"}" id="deactivateUser">
|
|
|
+ ${window.siyuan.languages.deactivateUser}
|
|
|
+ </button>
|
|
|
<span class="fn__flex-1"></span>
|
|
|
<button class="b3-button b3-button--cancel b3-tooltips b3-tooltips__n" id="refresh" aria-label="${window.siyuan.languages.refresh}">
|
|
|
<svg><use xlink:href="#iconRefresh"></use></svg>
|
|
@@ -208,6 +213,16 @@ ${window.siyuan.languages.account8}`;
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+ element.querySelector("#deactivateUser").addEventListener(getEventName(), () => {
|
|
|
+ confirmDialog("⚠️ " + window.siyuan.languages.deactivateUser, window.siyuan.languages.deactivateUserTip, () => {
|
|
|
+ fetchPost("/api/account/deactivate", {}, () => {
|
|
|
+ window.siyuan.user = null;
|
|
|
+ element.innerHTML = account.genHTML();
|
|
|
+ account.bindEvent(element);
|
|
|
+ account.onSetaccount();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
element.querySelectorAll("input[type='checkbox']").forEach(item => {
|
|
|
item.addEventListener("change", () => {
|
|
|
fetchPost("/api/setting/setAccount", {
|