mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
https://github.com/dcs-liberation/dcs_liberation/issues/2039 Partial fix for https://github.com/dcs-liberation/dcs_liberation/issues/2045 (now works in the new map, old one not fixed yet).
31 lines
760 B
TypeScript
31 lines
760 B
TypeScript
import { RootState } from "../app/store";
|
|
import { gameLoaded, gameUnloaded } from "./actions";
|
|
import SupplyRoute from "./supplyroute";
|
|
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
interface SupplyRoutesState {
|
|
routes: SupplyRoute[];
|
|
}
|
|
|
|
const initialState: SupplyRoutesState = {
|
|
routes: [],
|
|
};
|
|
|
|
export const supplyRoutesSlice = createSlice({
|
|
name: "supplyRoutes",
|
|
initialState,
|
|
reducers: {},
|
|
extraReducers: (builder) => {
|
|
builder.addCase(gameLoaded, (state, action) => {
|
|
state.routes = action.payload.supply_routes;
|
|
});
|
|
builder.addCase(gameUnloaded, (state) => {
|
|
state.routes = [];
|
|
});
|
|
},
|
|
});
|
|
|
|
export const selectSupplyRoutes = (state: RootState) => state.supplyRoutes;
|
|
|
|
export default supplyRoutesSlice.reducer;
|