mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-13 07:56:14 +01:00
This commit is contained in:
parent
6657343f3e
commit
9fdfa27682
2 changed files with 11 additions and 3 deletions
|
|
@ -258,7 +258,7 @@ export class Plugin {
|
||||||
this.setting.open(this.displayName || this.name);
|
this.setting.open(this.displayName || this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadData(storageName: string) {
|
public loadData(storageName: string): Promise<IWebSocketData> {
|
||||||
if (typeof this.data[storageName] === "undefined") {
|
if (typeof this.data[storageName] === "undefined") {
|
||||||
this.data[storageName] = "";
|
this.data[storageName] = "";
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +274,7 @@ export class Plugin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveData(storageName: string, data: any) {
|
public saveData(storageName: string, data: any): Promise<any | IWebSocketData> {
|
||||||
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
code: 403,
|
code: 403,
|
||||||
|
|
@ -312,7 +312,7 @@ export class Plugin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeData(storageName: string) {
|
public removeData(storageName: string): Promise<IWebSocketData> {
|
||||||
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
code: 403,
|
code: 403,
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,14 @@ export const fetchPost = (
|
||||||
cb(response);
|
cb(response);
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
if (failCallback && url === "/api/file/getFile") {
|
||||||
|
failCallback({
|
||||||
|
data: null,
|
||||||
|
msg: e.message,
|
||||||
|
code: 400,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.warn("fetch post failed [" + e + "], url [" + url + "]");
|
console.warn("fetch post failed [" + e + "], url [" + url + "]");
|
||||||
if (url === "/api/transactions" && (e.message === "Failed to fetch" || e.message === "Unexpected end of JSON input")) {
|
if (url === "/api/transactions" && (e.message === "Failed to fetch" || e.message === "Unexpected end of JSON input")) {
|
||||||
kernelError();
|
kernelError();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue