Completed Admin Users form
This commit is contained in:
@@ -27,3 +27,14 @@ export const getConnectedAircraftPositionLogAPI = async ({ id }: { id: number })
|
||||
}
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const kickAircraftAPI = async ({ id, bann }: { id: number; bann?: boolean }) => {
|
||||
const res = await serverApi.delete(`/aircrafts/${id}`, {
|
||||
data: { bann },
|
||||
});
|
||||
console.log(res.status);
|
||||
if (res.status != 204) {
|
||||
throw new Error("Failed to kick aircraft");
|
||||
}
|
||||
return res.data;
|
||||
};
|
||||
|
||||
@@ -35,3 +35,14 @@ export const getConnectedDispatcherAPI = async (filter?: Prisma.ConnectedDispatc
|
||||
}
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const kickDispatcherAPI = async ({ id, bann }: { id: number; bann?: boolean }) => {
|
||||
const res = await serverApi.delete(`/dispatcher/${id}`, {
|
||||
data: { bann },
|
||||
});
|
||||
console.log(res.status);
|
||||
if (res.status != 204) {
|
||||
throw new Error("Failed to kick aircraft");
|
||||
}
|
||||
return res.data;
|
||||
};
|
||||
|
||||
28
apps/dispatch/app/_querys/livekit.ts
Normal file
28
apps/dispatch/app/_querys/livekit.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Prisma, User } from "@repo/db";
|
||||
import axios from "axios";
|
||||
|
||||
export const editUserAPI = async (id: string, user: Prisma.UserUpdateInput) => {
|
||||
export const editUserAPI = async ({ id, user }: { id: string; user: Prisma.UserUpdateInput }) => {
|
||||
const response = await axios.post<User>(`/api/user?id=${id}`, user);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user