mirror of
https://github.com/suitenumerique/meet.git
synced 2026-09-01 21:28:00 +00:00
bf6f7430e7
Mark JS imports as type-only when applicable so they are stripped at build time and ignored during chunk splitting, ensuring we take full advantage of Rollup's code-splitting optimizations.
31 lines
752 B
TypeScript
31 lines
752 B
TypeScript
import { useMutation, type UseMutationOptions } from '@tanstack/react-query'
|
|
import { fetchApi } from '@/api/fetchApi'
|
|
import type { ApiError } from '@/api/ApiError'
|
|
import type { ApiRoom } from '@/features/rooms/api/ApiRoom'
|
|
|
|
export interface StartSubtitleParams {
|
|
id: string
|
|
token: string
|
|
}
|
|
|
|
const startSubtitle = ({
|
|
id,
|
|
token,
|
|
}: StartSubtitleParams): Promise<ApiRoom> => {
|
|
return fetchApi(`rooms/${id}/start-subtitle/`, {
|
|
method: 'POST',
|
|
headers: {
|
|
Authorization: `Bearer ${token}`,
|
|
},
|
|
})
|
|
}
|
|
|
|
export function useStartSubtitle(
|
|
options?: UseMutationOptions<ApiRoom, ApiError, StartSubtitleParams>
|
|
) {
|
|
return useMutation<ApiRoom, ApiError, StartSubtitleParams>({
|
|
mutationFn: startSubtitle,
|
|
...options,
|
|
})
|
|
}
|