added connectedDispatcher Query

This commit is contained in:
PxlLoewe
2025-06-01 16:03:31 -07:00
parent 2dab694bcd
commit cd4db06490
3 changed files with 56 additions and 10 deletions

View File

@@ -1,19 +1,25 @@
import { ConnectedAircraft, ConnectedDispatcher, Prisma } from "@repo/db";
import axios from "axios";
export const getConnectedUserAPI = async (
filter?: Prisma.KeywordWhereInput,
) => {
export const getConnectedUserAPI = async () => {
const res = await axios.get<(ConnectedAircraft | ConnectedDispatcher)[]>(
"/api/connected-user",
{
params: {
filter: JSON.stringify(filter),
},
},
{},
);
if (res.status !== 200) {
throw new Error("Failed to fetch Connected User");
}
return res.data;
};
export const getConnectedDispatcherAPI = async (filter?: Prisma.ConnectedDispatcherWhereInput) => {
const res = await axios.get<ConnectedDispatcher[]>("/api/dispatcher", {
params: {
filter: JSON.stringify(filter),
},
});
if (res.status !== 200) {
throw new Error("Failed to fetch Connected Dispatcher");
}
return res.data;
};