mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-20 07:12:18 +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.
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { fetchApi } from '@/api/fetchApi'
|
|
import { useQuery, type UseQueryOptions } from '@tanstack/react-query'
|
|
import type { ApiError } from '@/api/ApiError'
|
|
import { keys } from '@/api/queryKeys'
|
|
|
|
export type WaitingParticipant = {
|
|
id: string
|
|
status: string
|
|
username: string
|
|
color: string
|
|
}
|
|
|
|
export type WaitingParticipantsResponse = {
|
|
participants: WaitingParticipant[]
|
|
}
|
|
|
|
export type WaitingParticipantsParams = {
|
|
roomId: string
|
|
}
|
|
|
|
export const listWaitingParticipants = async ({
|
|
roomId,
|
|
}: WaitingParticipantsParams): Promise<WaitingParticipantsResponse> => {
|
|
return fetchApi<WaitingParticipantsResponse>(
|
|
`/rooms/${roomId}/waiting-participants/`,
|
|
{
|
|
method: 'GET',
|
|
}
|
|
)
|
|
}
|
|
|
|
export const useListWaitingParticipants = (
|
|
roomId: string,
|
|
queryOptions?: Omit<
|
|
UseQueryOptions<
|
|
WaitingParticipantsResponse,
|
|
ApiError,
|
|
WaitingParticipantsResponse
|
|
>,
|
|
'queryKey'
|
|
>
|
|
) => {
|
|
return useQuery<
|
|
WaitingParticipantsResponse,
|
|
ApiError,
|
|
WaitingParticipantsResponse
|
|
>({
|
|
queryKey: [keys.waitingParticipants, roomId],
|
|
queryFn: () => listWaitingParticipants({ roomId }),
|
|
...queryOptions,
|
|
})
|
|
}
|