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:
@@ -60,7 +60,7 @@ export function useDiscoverTemplates(serverId: number) {
|
||||
export function useAutoImportTemplates() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (serverId: number) => apiClient.post<{ success: boolean; count: number }>(`/templates/api/auto-import/${serverId}`),
|
||||
mutationFn: (serverId: number) => apiClient.post<{ success: boolean; imported_count: number }>(`/templates/api/auto-import/${serverId}`),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: templateKeys.groups });
|
||||
qc.invalidateQueries({ queryKey: ['templates'] });
|
||||
|
||||
Reference in New Issue
Block a user