added auto disconnect when changing link

This commit is contained in:
PxlLoewe
2025-06-02 15:04:15 -07:00
parent 72998a36a4
commit af36b82221
9 changed files with 72 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
import { ConnectedAircraft, ConnectedDispatcher, Prisma } from "@repo/db";
import { serverApi } from "_helpers/axios";
import axios from "axios";
export const getConnectedUserAPI = async () => {
@@ -12,6 +13,17 @@ export const getConnectedUserAPI = async () => {
return res.data;
};
export const changeDispatcherAPI = async (
id: number,
data: Prisma.ConnectedDispatcherUpdateInput,
) => {
const res = await serverApi.patch<ConnectedDispatcher>(`/dispatcher/${id}`, data);
if (res.status !== 200) {
throw new Error("Failed to update Connected Dispatcher");
}
return res.data;
};
export const getConnectedDispatcherAPI = async (filter?: Prisma.ConnectedDispatcherWhereInput) => {
const res = await axios.get<ConnectedDispatcher[]>("/api/dispatcher", {
params: {