feat: manage invitation
This commit is contained in:
parent
ae91f442f6
commit
4866602c26
|
|
@ -10,11 +10,11 @@ const showInvitationModal = ref(false);
|
|||
const inviteeEmail = ref("");
|
||||
|
||||
const { execute: refreshMentors, data: mentors } = useCSRFFetch(
|
||||
`/api/mentor/${courseSession.value.course.id}/mentors`
|
||||
`/api/mentor/${courseSession.value.id}/mentors`
|
||||
).json();
|
||||
|
||||
const { execute: refreshInvitations, data: invitations } = useCSRFFetch(
|
||||
`/api/mentor/${courseSession.value.course.id}/invitations`
|
||||
`/api/mentor/${courseSession.value.id}/invitations`
|
||||
).json();
|
||||
|
||||
const hasMentors = computed(() => {
|
||||
|
|
@ -31,22 +31,20 @@ const validEmail = computed(() => {
|
|||
|
||||
const removeInvitation = async (invitationId: string) => {
|
||||
await useCSRFFetch(
|
||||
`/api/mentor/${courseSession.value.course.id}/invitations/${invitationId}/delete`
|
||||
`/api/mentor/${courseSession.value.id}/invitations/${invitationId}/delete`
|
||||
).delete();
|
||||
await refreshInvitations();
|
||||
};
|
||||
|
||||
const removeMentor = async (mentorId: string) => {
|
||||
await useCSRFFetch(
|
||||
`/api/mentor/${courseSession.value.course.id}/mentors/${mentorId}/leave`
|
||||
`/api/mentor/${courseSession.value.id}/mentors/${mentorId}/leave`
|
||||
).delete();
|
||||
await refreshMentors();
|
||||
};
|
||||
|
||||
const inviteMentor = async () => {
|
||||
await useCSRFFetch(
|
||||
`/api/mentor/${courseSession.value.course.id}/invitations/create`
|
||||
).post({
|
||||
await useCSRFFetch(`/api/mentor/${courseSession.value.id}/invitations/create`).post({
|
||||
email: inviteeEmail.value,
|
||||
});
|
||||
await refreshInvitations();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
useCourseSessionDetailQuery,
|
||||
useCurrentCourseSession,
|
||||
} from "@/composables";
|
||||
import { bustItGetCache } from "@/fetchHelpers";
|
||||
import { bustItGetCache, useCSRFFetch } from "@/fetchHelpers";
|
||||
import { UPSERT_ASSIGNMENT_COMPLETION_MUTATION } from "@/graphql/mutations";
|
||||
import AssignmentSubmissionResponses from "@/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionResponses.vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
|
|
@ -61,6 +61,10 @@ const circleExpert = computed(() => {
|
|||
return circleExperts.value[0];
|
||||
});
|
||||
|
||||
const { data: learningMentors } = useCSRFFetch(
|
||||
`/api/mentor/${courseSession.value.id}/mentors`
|
||||
).json();
|
||||
|
||||
const circleExpertName = computed(() => {
|
||||
return `${circleExpert.value?.first_name} ${circleExpert.value?.last_name}`;
|
||||
});
|
||||
|
|
@ -156,7 +160,6 @@ const onSubmit = async () => {
|
|||
></ItCheckbox>
|
||||
<div v-if="mayBeEvaluated" class="w-full border-b border-gray-400">
|
||||
<ItCheckbox
|
||||
v-if="mayBeEvaluated"
|
||||
class="py-6"
|
||||
:checkbox-item="{
|
||||
label: isPraxisAssignment
|
||||
|
|
@ -178,6 +181,9 @@ const onSubmit = async () => {
|
|||
{{ circleExpertName }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
{{ learningMentors }}
|
||||
</div>
|
||||
<!-- TODO: find way to find user that will do the corrections -->
|
||||
</div>
|
||||
<div v-if="isCasework" class="flex flex-col space-x-2 pt-6 text-base sm:flex-row">
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class InvitationSerializer(serializers.ModelSerializer):
|
|||
def create(self, validated_data):
|
||||
participant = self.context["course_session_user"]
|
||||
invitation, _ = MentorInvitation.objects.get_or_create(
|
||||
email=validated_data["email"], defaults={"participant": participant}
|
||||
email=validated_data["email"], participant=participant
|
||||
)
|
||||
return invitation
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue