fix(templates): show clear message after auto-import instead of "undefined"
Some checks failed
Deploy to Production / Trigger production update (push) Has been cancelled
Some checks failed
Deploy to Production / Trigger production update (push) Has been cancelled
Frontend read res.count but the auto-import endpoint returns imported_count, so the toast showed "Импортировано: undefined". Read imported_count and show a distinct message when no new templates were imported. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,12 @@ export default function TemplatesPage() {
|
||||
if (!importServerId) return;
|
||||
autoImport.mutate(Number(importServerId), {
|
||||
onSuccess: (res) => {
|
||||
toast.success(`${t('templates.imported')}: ${res.count}`);
|
||||
const count = res.imported_count ?? 0;
|
||||
toast.success(
|
||||
count > 0
|
||||
? t('templates.imported_count', { count })
|
||||
: t('templates.imported_none'),
|
||||
);
|
||||
setImportDialogOpen(false);
|
||||
},
|
||||
onError: (err: Error) => toast.error(err.message),
|
||||
|
||||
Reference in New Issue
Block a user