Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: When access authentication fails, refresh the page to jump to the authentication page https://github.com/siyuan-note/siyuan/issues/15163

Danielb8bef2f95413
diff --git a/app/src/util/fetch.ts b/app/src/util/fetch.ts
index e6948f82f4..ae7783d6e4 100644
--- a/app/src/util/fetch.ts
+++ b/app/src/util/fetch.ts
@@ -34,9 +34,6 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
}
fetch(url, init).then((response) => {
switch (response.status) {
- case 401:
- // 返回鉴权失败的话直接刷新页面,避免用户在当前页面操作 https://github.com/siyuan-note/siyuan/issues/15163
- window.location.reload();
case 403:
case 404:
return {
@@ -45,6 +42,13 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
code: -response.status,
};
default:
+ if (401 == response.status) {
+ // 返回鉴权失败的话直接刷新页面,避免用户在当前页面操作 https://github.com/siyuan-note/siyuan/issues/15163
+ setTimeout(() => {
+ window.location.reload();
+ }, 3000);
+ }
+
if (response.headers.get("content-type")?.indexOf("application/json") > -1) {
return response.json();
} else {