Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {LoadableContent} from '../../model/loadable-content';
- import {NegativeKeywords} from '../../model/recommendations';
- import {
- FAILED_TO_LOAD_NEGATIVE_KEYWORDS,
- LOAD_NEGATIVE_KEYWORDS,
- LOADED_NEGATIVE_KEYWORDS,
- NegativeKeywordsAction
- } from '../actions/negative-keywords';
- export interface NegativeKeywordsState {
- negativeKeywords: LoadableContent<NegativeKeywords>;
- }
- const initialState: NegativeKeywordsState = {
- negativeKeywords: LoadableContent.loaded(new NegativeKeywords([], 0))
- };
- export function negativeKeywordsReducer(state: NegativeKeywordsState = initialState,
- action: NegativeKeywordsAction): NegativeKeywordsState {
- switch (action.type) {
- case LOAD_NEGATIVE_KEYWORDS:
- return {
- negativeKeywords: LoadableContent.loading()
- };
- case LOADED_NEGATIVE_KEYWORDS:
- return {
- negativeKeywords: LoadableContent.loaded(action.result)
- };
- case FAILED_TO_LOAD_NEGATIVE_KEYWORDS:
- return {
- negativeKeywords: LoadableContent.failedToLoad()
- };
- default:
- return state;
- }
- }
- export const selectNegativeKeywords = (state: NegativeKeywordsState) => state.negativeKeywords;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement