mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-09 02:10:34 +00:00
d1dde71bea
Reorganize all participant list related code elements into a dedicated feature folder, so related components, hooks and helpers are grouped together and easier to locate.
28 lines
748 B
TypeScript
28 lines
748 B
TypeScript
import type { Participant } from 'livekit-client'
|
|
import { fetchApi } from '@/api/fetchApi.ts'
|
|
import { useRoomData } from '@/features/rooms/livekit/hooks/useRoomData'
|
|
|
|
export const useLowerHandParticipant = () => {
|
|
const data = useRoomData()
|
|
|
|
const lowerHandParticipant = async (participant: Participant) => {
|
|
if (!data?.id) {
|
|
throw new Error('Room id is not available')
|
|
}
|
|
|
|
const newAttributes = {
|
|
...participant.attributes,
|
|
handRaisedAt: '',
|
|
}
|
|
|
|
return await fetchApi(`rooms/${data.id}/update-participant/`, {
|
|
method: 'POST',
|
|
body: JSON.stringify({
|
|
participant_identity: participant.identity,
|
|
attributes: newAttributes,
|
|
}),
|
|
})
|
|
}
|
|
return { lowerHandParticipant }
|
|
}
|