2017-06-29 12:54:02 -06:00
|
|
|
import { authReducer as auth } from "../auth/reducer";
|
|
|
|
import { botReducer as bot } from "../devices/reducer";
|
|
|
|
import { configReducer as config } from "../config/reducer";
|
|
|
|
import { draggableReducer as draggable } from "../draggable/reducer";
|
|
|
|
import { combineReducers } from "redux";
|
2019-12-27 13:58:44 -07:00
|
|
|
import { ReduxAction, Reducers } from "./interfaces";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { Session } from "../session";
|
2019-12-10 13:17:37 -07:00
|
|
|
import { resourceReducer as resources } from "../resources/reducer";
|
2017-06-30 10:07:30 -06:00
|
|
|
import { Everything } from "../interfaces";
|
2017-07-07 07:12:14 -06:00
|
|
|
import { Actions } from "../constants";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
2019-12-27 13:58:44 -07:00
|
|
|
export const reducers: Reducers = combineReducers({
|
2017-06-29 12:54:02 -06:00
|
|
|
auth,
|
|
|
|
bot,
|
|
|
|
config,
|
|
|
|
draggable,
|
2019-12-27 13:58:44 -07:00
|
|
|
resources,
|
2019-12-10 11:52:48 -07:00
|
|
|
});
|
2019-12-10 13:17:37 -07:00
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
/** This is the topmost reducer in the application. If you need to preempt a
|
|
|
|
* "normal" reducer this is the place to do it */
|
2019-12-10 11:52:48 -07:00
|
|
|
export function rootReducer(state: Everything, action: ReduxAction<{}>) {
|
2018-01-04 11:23:06 -07:00
|
|
|
(action.type === Actions.LOGOUT) && Session.clear();
|
2018-05-04 09:42:51 -06:00
|
|
|
return reducers(state, action);
|
2017-07-07 07:12:14 -06:00
|
|
|
}
|