You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
hexmap/client/src/reducers/NetworkReducer.ts

20 lines
670 B

import {AppState} from "../state/AppState";
import {isClientAction, NetworkAction} from "../actions/NetworkAction";
import {clientReducer} from "./ClientReducer";
import {serverReducer} from "./ServerReducer";
export function networkReducer(oldState: AppState, action: NetworkAction): AppState {
if (isClientAction(action)) {
const newState = clientReducer(oldState.network, action)
if (newState === oldState.network)
{
return oldState
}
return {
...oldState,
network: newState
}
} else /* if (isServerAction(action)) */ {
return serverReducer(oldState, action)
}
}