implemented connectedDispatch record for dispatcher

This commit is contained in:
PxlLoewe
2025-05-01 21:48:25 -07:00
parent 504ef3cdb8
commit 26e71bcaa8
16 changed files with 287 additions and 115 deletions

View File

@@ -1,3 +1,4 @@
import { ConnectedAircraft, ConnectedDispatcher } from "@repo/db";
import axios from "axios";
export const serverApi = axios.create({
@@ -7,3 +8,15 @@ export const serverApi = axios.create({
"Content-Type": "application/json",
},
});
export const getConenctedUsers = async (): Promise<
(ConnectedDispatcher | ConnectedAircraft)[]
> => {
const res = await serverApi.get<(ConnectedDispatcher | ConnectedAircraft)[]>(
"/status/connected-users",
);
if (res.status !== 200) {
throw new Error("Failed to fetch connected users");
}
return res.data;
};