mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 19:52:03 +08:00
refactor(web): migrate core toast call sites to base ui toast (#33643)
This commit is contained in:
@@ -2,7 +2,7 @@ import type { AfterResponseHook, BeforeRequestHook, Hooks } from 'ky'
|
||||
import type { IOtherOptions } from './base'
|
||||
import Cookies from 'js-cookie'
|
||||
import ky, { HTTPError } from 'ky'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { toast } from '@/app/components/base/ui/toast'
|
||||
import { API_PREFIX, APP_VERSION, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, IS_MARKETPLACE, MARKETPLACE_API_PREFIX, PASSPORT_HEADER_NAME, PUBLIC_API_PREFIX, WEB_APP_SHARE_CODE_HEADER_NAME } from '@/config'
|
||||
import { getWebAppAccessToken, getWebAppPassport } from './webapp-auth'
|
||||
|
||||
@@ -48,7 +48,7 @@ const afterResponseErrorCode = (otherOptions: IOtherOptions): AfterResponseHook
|
||||
const shouldNotifyError = response.status !== 401 && errorData && !otherOptions.silent
|
||||
|
||||
if (shouldNotifyError)
|
||||
Toast.notify({ type: 'error', message: errorData.message })
|
||||
toast.add({ type: 'error', title: errorData.message })
|
||||
|
||||
if (response.status === 403 && errorData?.code === 'already_setup')
|
||||
globalThis.location.href = `${globalThis.location.origin}/signin`
|
||||
|
||||
Reference in New Issue
Block a user