import {Dialog} from "../dialog"; import {isMobile} from "../util/functions"; import {fetchPost} from "../util/fetch"; export const setAccessAuthCode = () => { const dialog = new Dialog({ title: window.siyuan.languages.about5, content: `
${window.siyuan.languages.about6}
`, width: isMobile() ? "80vw" : "520px", }); const inputElement = dialog.element.querySelector("input") as HTMLInputElement; const btnsElement = dialog.element.querySelectorAll(".b3-button"); dialog.bindInput(inputElement, () => { (btnsElement[1] as HTMLButtonElement).click(); }); inputElement.select(); btnsElement[0].addEventListener("click", () => { dialog.destroy(); }); btnsElement[1].addEventListener("click", () => { fetchPost("/api/system/setAccessAuthCode", {accessAuthCode: inputElement.value}); }); };