fix(ui): condition names to be unique

This commit is contained in:
nick-delirium 2024-01-26 11:42:18 +01:00
parent 0a6efe933f
commit fc7183e504

View file

@ -85,6 +85,14 @@ export default class SettingsStore {
updateCaptureConditions = (projectId: number, data: CaptureConditions) => {
this.loadingCaptureRate = true;
const duplicates = data.conditions.filter(
(c, index) => data.conditions.findIndex((c2) => c2.name === c.name) !== index
);
if (duplicates.length > 0) {
toast.error('Condition set names must be unique');
this.loadingCaptureRate = false;
return;
}
return sessionService
.saveCaptureConditions(projectId, data)
.then((data) => data.json())