Completed Admin Users form

This commit is contained in:
PxlLoewe
2025-06-04 17:27:58 -07:00
parent 7aceae7c17
commit 3c620b9b67
22 changed files with 592 additions and 235 deletions

View File

@@ -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;
};

View File

@@ -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;
};

View 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;
};

View File

@@ -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;
};