-
-
Save DanyF-github/3bfdd27dffa5b262ccc3593060fad795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// client/src/components/Videocall/Attendees.tsx | |
import { useMutation } from '@apollo/client'; | |
import React from 'react'; | |
import { useLocation } from 'react-router'; | |
import { INVITE_STUDENT } from '../../data/mutations'; | |
import { Student, StudentListAction } from '../../models'; | |
import { StudentsList } from '../Students'; | |
const Attendees = () => { | |
// create the mutate function | |
const [inviteStudent] = useMutation(INVITE_STUDENT) | |
// get the session url | |
const location = useLocation(); | |
// create the custom action in an array | |
const actions = new Array<StudentListAction>( | |
{ | |
// set a name | |
actionName: 'Invite', | |
// set the action | |
onAction: (student: Student) => { | |
inviteStudent({ | |
variables: { | |
phoneNumber: student.phoneNumber, | |
url: window.location.origin + location.pathname | |
} | |
}) | |
} | |
} | |
) | |
// render the StudentsList and pass the action | |
return ( | |
<> | |
<StudentsList actions={actions}/> | |
</> | |
) | |
} | |
export default Attendees; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment