Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: Ignore the error toast notification if the status is 401 and isPublicAPI is true (#9062)

NFish4abca8614f2d
diff --git a/web/service/base.ts b/web/service/base.ts
index 83389d8be80..fbdd5c1fd35 100644
--- a/web/service/base.ts
+++ b/web/service/base.ts
@@ -359,9 +359,6 @@ const baseFetch = <T>(
case 401: {
if (isPublicAPI) {
return bodyJson.then((data: ResponseError) => {
- if (!silent)
- Toast.notify({ type: 'error', message: data.message })
-
if (data.code === 'web_sso_auth_required')
requiredWebSSOLogin()
@@ -536,8 +533,6 @@ export const ssePost = (
.then((res) => {
if (!/^(2|3)\d{2}$/.test(String(res.status))) {
res.json().then((data: any) => {
- Toast.notify({ type: 'error', message: data.message || 'Server Error' })
-
if (isPublicAPI) {
if (data.code === 'web_sso_auth_required')
requiredWebSSOLogin()
@@ -546,7 +541,10 @@ export const ssePost = (
removeAccessToken()
globalThis.location.reload()
}
+ if (res.status === 401)
+ return
}
+ Toast.notify({ type: 'error', message: data.message || 'Server Error' })
})
onError?.('Server Error')
return