♻️ 当 code 大于 0 时同样需要进行相关的业务处理 https://github.com/siyuan-note/siyuan/pull/11367

This commit is contained in:
Vanessa 2024-06-12 23:11:31 +08:00
parent c07a1a69db
commit 19dd387064
4 changed files with 9 additions and 14 deletions

View file

@ -310,12 +310,10 @@ export const editor = {
if (fontFamilyElement.tagName === "SELECT") {
let fontFamilyHTML = `<option value="">${window.siyuan.languages.default}</option>`;
fetchPost("/api/system/getSysFonts", {}, (response) => {
if (response.code === 0) {
response.data.forEach((item: string) => {
fontFamilyHTML += `<option value="${item}"${window.siyuan.config.editor.fontFamily === item ? " selected" : ""}>${item}</option>`;
});
fontFamilyElement.innerHTML = fontFamilyHTML;
}
response.data.forEach((item: string) => {
fontFamilyHTML += `<option value="${item}"${window.siyuan.config.editor.fontFamily === item ? " selected" : ""}>${item}</option>`;
});
fontFamilyElement.innerHTML = fontFamilyHTML;
});
}
editor.element.querySelector("#clearHistory").addEventListener("click", () => {
@ -337,7 +335,7 @@ export const editor = {
fetchPost("/api/setting/setEditor", {
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
markdown: {
markdown: {
inlineSup: (editor.element.querySelector("#editorMarkdownInlineSup") as HTMLInputElement).checked,
inlineSub: (editor.element.querySelector("#editorMarkdownInlineSub") as HTMLInputElement).checked,
inlineTag: (editor.element.querySelector("#editorMarkdownInlineTag") as HTMLInputElement).checked,

View file

@ -507,9 +507,8 @@ export const exportMd = (id: string) => {
});
});
return;
} else if (response.code === 0) {
showMessage(window.siyuan.languages.exportTplSucc);
}
showMessage(window.siyuan.languages.exportTplSucc);
});
dialog.destroy();
});

View file

@ -150,10 +150,8 @@ export const initAssets = () => {
return;
}
}
if (response.code === 0) {
window.siyuan.config.appearance = response.data.appearance;
loadAssets(response.data.appearance);
}
window.siyuan.config.appearance = response.data.appearance;
loadAssets(response.data.appearance);
});
});
};

View file

@ -38,7 +38,7 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
return {
data: null,
msg: response.statusText,
code: response.status,
code: -response.status,
};
default:
if (response.headers.get("content-type")?.indexOf("application/json") > -1) {