29 lines
669 B
TypeScript
29 lines
669 B
TypeScript
import axios from "axios";
|
|
import { Room } from "livekit-client";
|
|
import { ParticipantInfo } from "livekit-server-sdk";
|
|
|
|
export const getLivekitRooms = async () => {
|
|
const res = await axios.get<
|
|
{
|
|
room: Room;
|
|
participants: ParticipantInfo[];
|
|
}[]
|
|
>("/api/livekit-participant");
|
|
|
|
if (res.status !== 200) {
|
|
throw new Error("Failed to fetch keywords");
|
|
}
|
|
return res.data;
|
|
};
|
|
|
|
export const kickLivekitParticipant = async (body: { identity: string; roomName: string }) => {
|
|
const res = await axios.delete("/api/livekit-participant", {
|
|
params: body,
|
|
});
|
|
|
|
if (res.status !== 200) {
|
|
throw new Error("Failed to kick participant");
|
|
}
|
|
return res.data;
|
|
};
|