This commit is contained in:
Vanessa 2023-05-16 00:04:25 +08:00
parent fdf9f0d9e4
commit 1ac623ebb1
5 changed files with 79 additions and 17 deletions

View file

@ -29,11 +29,11 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
}
fetch(url, init).then((response) => {
if (response.status === 404) {
cb({
return {
data: null,
msg: response.statusText,
code: response.status,
});
};
} else {
if (response.headers.get("content-type").indexOf("application/json") > -1) {
return response.json();
@ -48,6 +48,9 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
}
return;
}
if (typeof response.msg === "undefined") {
return;
}
if (["/api/search/searchRefBlock", "/api/graph/getGraph", "/api/graph/getLocalGraph"].includes(url)) {
if (response.data.reqId && window.siyuan.reqIds[url] && window.siyuan.reqIds[url] > response.data.reqId) {
return;