feat: update permissions

This commit is contained in:
ivannoskov
2026-02-10 17:41:11 +03:00
parent e1117e46c8
commit f0574db79f
7 changed files with 335 additions and 140 deletions

View File

@@ -27,6 +27,7 @@ import {
} from "@/components/ui/popover";
import { cn } from "@/lib/utils";
import { placementsApi, creativesApi, channelsApi } from "@/lib/api";
import { isPermissionError, showSuccessToast, showErrorToast } from "@/lib/utils/error-handler";
import { ChannelInput, type ParsedChannel } from "@/components/channel-input";
import type { Creative } from "@/lib/types/api";
@@ -161,10 +162,15 @@ export function PlacementWizard({
})),
});
showSuccessToast("Размещения созданы", "Успешно добавлено");
onOpenChange(false);
onSuccess?.();
} catch (err: any) {
setError(err?.detail || "Ошибка создания размещения");
if (isPermissionError(err)) {
showErrorToast("Недостаточно прав", "Обратитесь к администратору");
} else {
setError(err?.detail || "Ошибка создания размещения");
}
} finally {
setSubmitting(false);
}