mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
refactor(web): update frontend toast call sites to use the new shortcut API (#33808)
Signed-off-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -40,17 +40,11 @@ const OutputVarList: FC<Props> = ({
|
||||
const { run: validateVarInput } = useDebounceFn((existingVariables: typeof list, newKey: string) => {
|
||||
const result = checkKeys([newKey], true)
|
||||
if (!result.isValid) {
|
||||
toast.add({
|
||||
type: 'error',
|
||||
title: t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }),
|
||||
})
|
||||
toast.error(t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }))
|
||||
return
|
||||
}
|
||||
if (existingVariables.some(key => key.variable?.trim() === newKey.trim())) {
|
||||
toast.add({
|
||||
type: 'error',
|
||||
title: t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }),
|
||||
})
|
||||
toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }))
|
||||
}
|
||||
}, { wait: 500 })
|
||||
|
||||
|
||||
@ -53,17 +53,11 @@ const VarList: FC<Props> = ({
|
||||
const { run: validateVarInput } = useDebounceFn((list: Variable[], newKey: string) => {
|
||||
const result = checkKeys([newKey], true)
|
||||
if (!result.isValid) {
|
||||
toast.add({
|
||||
type: 'error',
|
||||
title: t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }),
|
||||
})
|
||||
toast.error(t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }))
|
||||
return
|
||||
}
|
||||
if (list.some(item => item.variable?.trim() === newKey.trim())) {
|
||||
toast.add({
|
||||
type: 'error',
|
||||
title: t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }),
|
||||
})
|
||||
toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }))
|
||||
}
|
||||
}, { wait: 500 })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user