Skip to content

Commit

Permalink
✨ Add action creators and reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-murphy committed Jul 17, 2019
1 parent 11049f8 commit 6bf2845
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
26 changes: 26 additions & 0 deletions src/store/actions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
ADD_SELECTED_LABEL,
REMOVE_SELECTED_LABEL,
SET_SELECTED_LANGUAGE,
SET_KEYWORDS
} from "store/constants";

export const addSelectedLabel = label => ({
type: ADD_SELECTED_LABEL,
payload: label
});

export const removeSelectedLabel = label => ({
type: REMOVE_SELECTED_LABEL,
payload: label
});

export const setSelectedLanguage = language => ({
type: SET_SELECTED_LANGUAGE,
payload: language
});

export const setKeywords = keywords => ({
type: SET_KEYWORDS,
payload: keywords
});
7 changes: 2 additions & 5 deletions src/store/reducer/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
import search from "store/reducer/search";
import results from "store/reducer/results";
import { combineReducers } from "redux";

export default combineReducers({ search, results });
export { default as search } from "store/reducer/search";
export { default as results } from "store/reducer/results";
1 change: 1 addition & 0 deletions src/store/reducer/results.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default (state, _action) => state;

0 comments on commit 6bf2845

Please sign in to comment.