Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 1x 1x 1x 1x 1x 1x 23x 1x 1x 23x 1x 1x 1x 1x 1x 1x 1x 1x 1x 23x 23x 23x 23x 1x 1x 23x 23x 23x 23x 23x 23x 23x | import IndividualAssignmentForm from "main/components/Assignments/IndividualAssignmentForm";
import { Card, Row } from "react-bootstrap";
import { useBackendMutation } from "main/utils/useBackend";
import { toast } from "react-toastify";
import React from "react";
export default function AssignmentTabComponent({ courseId }) {
const onSuccessAssignment = () => {
toast("Repository creation successfully started.");
};
const objectToAxiosParamsIndividualAssignment = (assignment) => ({
url: `/api/repos/createRepos`,
method: "POST",
params: {
courseId: courseId,
repoPrefix: assignment.repoPrefix,
isPrivate: assignment.assignmentPrivacy,
permissions: assignment.permissions,
},
});
const indvidiualAssignmentMutation = useBackendMutation(
objectToAxiosParamsIndividualAssignment,
{ onSuccess: onSuccessAssignment },
);
const postIndividualAssignment = (assignment) => {
indvidiualAssignmentMutation.mutate(assignment);
};
return (
<Row md={2} data-testid={"AssignmentTabComponent"}>
<Card>
<Card.Header>Individual Assignment</Card.Header>
<Card.Body>
<IndividualAssignmentForm submitAction={postIndividualAssignment} />
</Card.Body>
</Card>
</Row>
);
}
|