Skip to content

Commit 9463cec

Browse files
authored
Bugfix: Duplicate survey status or survey status label (#340)
1 parent 460b4bd commit 9463cec

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/modules/SurveyInformation/SurveyStatusMapping/SurveyStatusMapping.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ function SurveyStatusMapping() {
164164
setEditingData(rowData);
165165
setEditingMode("edit");
166166
};
167-
168167
const onAddMapping = () => {
169168
if (!sctoForm.form_uid) return;
170169

@@ -183,7 +182,7 @@ function SurveyStatusMapping() {
183182
}
184183

185184
// Check if survey status and survey status label already exists
186-
targetStatusMapping.forEach((ele: any) => {
185+
for (const ele of targetStatusMapping) {
187186
if (ele.survey_status === parseInt(editingData.survey_status)) {
188187
message.error(
189188
"Survey status already exists, please add unique survey status!"
@@ -200,15 +199,15 @@ function SurveyStatusMapping() {
200199
);
201200
return;
202201
}
203-
});
202+
}
204203

205204
dispatch(
206205
updateTargetStatusMapping({
207206
formUID: sctoForm.form_uid,
208207
data: [...targetStatusMapping, editingData],
209208
})
210209
).then((res) => {
211-
if (res.payload.data.success) {
210+
if (res.payload.data && res.payload.data.success === true) {
212211
message.success("Mapping added successfully!");
213212
setEditingMode(null);
214213
setSelectedRowKeys([]);

0 commit comments

Comments
 (0)