mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 13:55:58 +08:00
fix: Ignore the error toast notification if the status is 401 and isPublicAPI is true (#9062)
This commit is contained in:
parent
7c0b159a81
commit
4abca8614f
@ -359,9 +359,6 @@ const baseFetch = <T>(
|
|||||||
case 401: {
|
case 401: {
|
||||||
if (isPublicAPI) {
|
if (isPublicAPI) {
|
||||||
return bodyJson.then((data: ResponseError) => {
|
return bodyJson.then((data: ResponseError) => {
|
||||||
if (!silent)
|
|
||||||
Toast.notify({ type: 'error', message: data.message })
|
|
||||||
|
|
||||||
if (data.code === 'web_sso_auth_required')
|
if (data.code === 'web_sso_auth_required')
|
||||||
requiredWebSSOLogin()
|
requiredWebSSOLogin()
|
||||||
|
|
||||||
@ -536,8 +533,6 @@ export const ssePost = (
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!/^(2|3)\d{2}$/.test(String(res.status))) {
|
if (!/^(2|3)\d{2}$/.test(String(res.status))) {
|
||||||
res.json().then((data: any) => {
|
res.json().then((data: any) => {
|
||||||
Toast.notify({ type: 'error', message: data.message || 'Server Error' })
|
|
||||||
|
|
||||||
if (isPublicAPI) {
|
if (isPublicAPI) {
|
||||||
if (data.code === 'web_sso_auth_required')
|
if (data.code === 'web_sso_auth_required')
|
||||||
requiredWebSSOLogin()
|
requiredWebSSOLogin()
|
||||||
@ -546,7 +541,10 @@ export const ssePost = (
|
|||||||
removeAccessToken()
|
removeAccessToken()
|
||||||
globalThis.location.reload()
|
globalThis.location.reload()
|
||||||
}
|
}
|
||||||
|
if (res.status === 401)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
Toast.notify({ type: 'error', message: data.message || 'Server Error' })
|
||||||
})
|
})
|
||||||
onError?.('Server Error')
|
onError?.('Server Error')
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user