Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✨(frontend) add client-side API call for participant removal

lebaudantoine34fde1085461
diff --git a/src/frontend/src/features/rooms/api/removeParticipant.ts b/src/frontend/src/features/rooms/api/removeParticipant.ts
new file mode 100644
index 00000000..aba45dad
--- /dev/null
+++ b/src/frontend/src/features/rooms/api/removeParticipant.ts
@@ -0,0 +1,21 @@
+import { Participant } from 'livekit-client'
+import { useRoomData } from '../livekit/hooks/useRoomData'
+import { fetchApi } from '@/api/fetchApi'
+
+export const useRemoveParticipant = () => {
+ const data = useRoomData()
+
+ const removeParticipant = async (participant: Participant) => {
+ if (!data?.id) {
+ throw new Error('Room id is not available')
+ }
+
+ return fetchApi(`rooms/${data.id}/remove-participant/`, {
+ method: 'POST',
+ body: JSON.stringify({
+ participant_identity: participant.identity,
+ }),
+ })
+ }
+ return { removeParticipant }
+}