feat: kleine correctie in form component
This commit is contained in:
parent
36f7cfa4bd
commit
83b15a392d
3 changed files with 64 additions and 53 deletions
|
@ -6,6 +6,7 @@
|
|||
* @param selectedClasses - The selected classes, an array of class objects.
|
||||
* @param groups - An array of groups, each containing student IDs.
|
||||
* @param deadline - The deadline of the assignment in ISO format.
|
||||
* @param description - The description of the aasignment
|
||||
* Sends a POST request to the backend with the form data.
|
||||
*/
|
||||
export const submitForm = async (
|
||||
|
@ -13,14 +14,16 @@ export const submitForm = async (
|
|||
selectedLearningPath: any,
|
||||
selectedClasses: any[],
|
||||
groups: string[][],
|
||||
deadline: string
|
||||
deadline: string,
|
||||
description: string
|
||||
) => {
|
||||
const formData = {
|
||||
title: assignmentTitle,
|
||||
hruid: selectedLearningPath?.hruid,
|
||||
classes: selectedClasses.map(cl => cl.value),
|
||||
groups: groups,
|
||||
deadline: deadline
|
||||
deadline: deadline,
|
||||
description: description
|
||||
};
|
||||
|
||||
try {
|
||||
|
@ -93,3 +96,10 @@ export const deadlineRules = [
|
|||
return true;
|
||||
},
|
||||
];
|
||||
|
||||
export const descriptionRules = [
|
||||
(value: string) => {
|
||||
if (!value || value.trim() === "") return "Description cannot be empty.";
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue