2018-02-20 09:30:36 +00:00
|
|
|
/* @flow */
|
2018-08-14 13:18:16 +00:00
|
|
|
import * as SUMMARY from 'actions/constants/summary';
|
|
|
|
import { initialState } from 'reducers/SummaryReducer';
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2019-03-04 12:33:02 +00:00
|
|
|
import type { ThunkAction, Action, Dispatch } from 'flowtype';
|
2018-08-14 13:18:16 +00:00
|
|
|
import type { State } from 'reducers/SummaryReducer';
|
2018-04-16 21:19:50 +00:00
|
|
|
|
2019-03-04 12:33:02 +00:00
|
|
|
export type SummaryAction =
|
|
|
|
| {
|
|
|
|
type: typeof SUMMARY.INIT,
|
|
|
|
state: State,
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
type: typeof SUMMARY.DISPOSE,
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
type: typeof SUMMARY.DETAILS_TOGGLE,
|
|
|
|
};
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-09-06 15:04:28 +00:00
|
|
|
export const init = (): ThunkAction => (dispatch: Dispatch): void => {
|
2018-07-30 10:52:13 +00:00
|
|
|
const state: State = {
|
|
|
|
...initialState,
|
|
|
|
};
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
dispatch({
|
|
|
|
type: SUMMARY.INIT,
|
|
|
|
state,
|
|
|
|
});
|
|
|
|
};
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
export const dispose = (): Action => ({
|
|
|
|
type: SUMMARY.DISPOSE,
|
|
|
|
});
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
export const onDetailsToggle = (): Action => ({
|
|
|
|
type: SUMMARY.DETAILS_TOGGLE,
|
|
|
|
});
|