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:
yyh
2026-03-20 16:02:22 +08:00
committed by GitHub
parent ac87704685
commit 27ed40225d
75 changed files with 391 additions and 706 deletions

View File

@ -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 })

View File

@ -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 })