mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
28 lines
646 B
TypeScript
28 lines
646 B
TypeScript
import { RootState } from "../app/store";
|
|
import FrontLine from "./frontline";
|
|
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
|
|
|
|
interface FrontLinesState {
|
|
fronts: FrontLine[];
|
|
}
|
|
|
|
const initialState: FrontLinesState = {
|
|
fronts: [],
|
|
};
|
|
|
|
export const frontLinesSlice = createSlice({
|
|
name: "frontLines",
|
|
initialState,
|
|
reducers: {
|
|
setFrontLines: (state, action: PayloadAction<FrontLine[]>) => {
|
|
state.fronts = action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setFrontLines } = frontLinesSlice.actions;
|
|
|
|
export const selectFrontLines = (state: RootState) => state.frontLines;
|
|
|
|
export default frontLinesSlice.reducer;
|