Simulator nicht verbunden warnung
This commit is contained in:
@@ -9,7 +9,7 @@ import { useAudioStore } from "_store/audioStore";
|
||||
interface ConnectionStore {
|
||||
status: "connected" | "disconnected" | "connecting" | "error";
|
||||
message: string;
|
||||
|
||||
debug: boolean;
|
||||
logoffTime: string;
|
||||
selectedStation: Station | null;
|
||||
connectedAircraft: ConnectedAircraft | null;
|
||||
@@ -24,6 +24,7 @@ interface ConnectionStore {
|
||||
logoffTime: string,
|
||||
station: Station,
|
||||
user: User,
|
||||
debug?: boolean,
|
||||
) => Promise<void>;
|
||||
disconnect: () => void;
|
||||
}
|
||||
@@ -35,14 +36,16 @@ export const usePilotConnectionStore = create<ConnectionStore>((set) => ({
|
||||
selectedStation: null,
|
||||
connectedAircraft: null,
|
||||
activeMission: null,
|
||||
debug: false,
|
||||
|
||||
connect: async (uid, stationId, logoffTime, station, user) =>
|
||||
connect: async (uid, stationId, logoffTime, station, user, debug) =>
|
||||
new Promise((resolve) => {
|
||||
set({
|
||||
status: "connecting",
|
||||
message: "",
|
||||
selectedStation: station,
|
||||
logoffTime,
|
||||
debug,
|
||||
});
|
||||
|
||||
pilotSocket.auth = { uid };
|
||||
@@ -64,13 +67,14 @@ export const usePilotConnectionStore = create<ConnectionStore>((set) => ({
|
||||
|
||||
pilotSocket.on("connect", () => {
|
||||
usePilotConnectionStore.setState({ status: "connected", message: "" });
|
||||
const { logoffTime, selectedStation } = usePilotConnectionStore.getState();
|
||||
const { logoffTime, selectedStation, debug } = usePilotConnectionStore.getState();
|
||||
dispatchSocket.disconnect();
|
||||
useAudioStore.getState().connect("LST_01", selectedStation?.bosCallsignShort || "pilot");
|
||||
|
||||
pilotSocket.emit("connect-pilot", {
|
||||
logoffTime,
|
||||
stationId: selectedStation?.id,
|
||||
debug,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user