accelerator-core
Version:
[](https://travis-ci.org/furkleindustries/accelerator-core)
30 lines (27 loc) • 605 B
text/typescript
import {
ActionTypes,
} from '../actions/ActionTypes';
import {
IStoryResetAction,
} from '../actions/IStoryResetAction';
import {
IStoryStateAction,
} from '../actions/IStoryStateAction';
import {
IStoryStateFrame,
} from '../state/IStoryStateFrame';
export function storyStateReducer(
previousState: IStoryStateFrame = {},
action: IStoryStateAction | IStoryResetAction,
)
{
if (action.type === ActionTypes.StoryState) {
return {
...previousState,
...action.value,
};
} else if (action.type === ActionTypes.StoryReset) {
return {};
}
return previousState;
}