diff --git a/peer-prep-fe/src/add-page/add-page.component.html b/peer-prep-fe/src/add-page/add-page.component.html
index 2f5a6d1fda..8140358bb5 100644
--- a/peer-prep-fe/src/add-page/add-page.component.html
+++ b/peer-prep-fe/src/add-page/add-page.component.html
@@ -93,6 +93,6 @@
CATEGORY
-
+
diff --git a/peer-prep-fe/src/add-page/add-page.component.ts b/peer-prep-fe/src/add-page/add-page.component.ts
index 2c5e19c8fa..bbafe961da 100644
--- a/peer-prep-fe/src/add-page/add-page.component.ts
+++ b/peer-prep-fe/src/add-page/add-page.component.ts
@@ -79,6 +79,13 @@ export class AddPageComponent {
this.questionForm.markAllAsTouched()
return
}
+
+ const selectedCategories = this.question_categories.filter(cat => cat.selected);
+ if (selectedCategories.length === 0) {
+ alert("Please select at least one category.");
+ return;
+ }
+
const newQuestion = {
Question_title: this.questionForm.value.question_title,
Question_description: this.questionForm.value.question_description,
@@ -94,7 +101,7 @@ export class AddPageComponent {
this.onAddComplete()
},
(error) => {
- alert("Error adding question")
+ alert("Question with the same title already exists, duplicate questions aren’t allowed!")
}
)
}
diff --git a/peer-prep-fe/src/edit-page/edit-page.component.html b/peer-prep-fe/src/edit-page/edit-page.component.html
index 5a2ccad98a..9fd3047046 100644
--- a/peer-prep-fe/src/edit-page/edit-page.component.html
+++ b/peer-prep-fe/src/edit-page/edit-page.component.html
@@ -87,6 +87,6 @@ CATEGORY
-
+
diff --git a/peer-prep-fe/src/edit-page/edit-page.component.ts b/peer-prep-fe/src/edit-page/edit-page.component.ts
index 5a1d544eed..1a9c9e605d 100644
--- a/peer-prep-fe/src/edit-page/edit-page.component.ts
+++ b/peer-prep-fe/src/edit-page/edit-page.component.ts
@@ -117,7 +117,7 @@ export class EditPageComponent implements OnInit {
this.onEditComplete()
},
(error) => {
- alert("Error updating question")
+ alert("Question with the same title already exists, duplicate questions aren’t allowed!")
}
)
}