diff options
Diffstat (limited to 'src/redux')
| -rw-r--r-- | src/redux/preference/actions.js | 11 | ||||
| -rw-r--r-- | src/redux/preference/reducer.js | 12 | ||||
| -rw-r--r-- | src/redux/preference/types.js | 1 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/redux/preference/actions.js b/src/redux/preference/actions.js index 1045b6b..3183b81 100644 --- a/src/redux/preference/actions.js +++ b/src/redux/preference/actions.js @@ -1,4 +1,4 @@ -import { UPDATE_OPTIONS, UPDATE_VIEW_TYPE } from './types'; +import { UPDATE_LANGUAGE, UPDATE_OPTIONS, UPDATE_VIEW_TYPE } from './types'; export const updateOptions = function (setting) { return dispatch => { @@ -17,3 +17,12 @@ export const updateViewType = function (viewType = 'grid') { }); }; }; + +export const updateLanguage = function (language) { + return dispatch => { + dispatch({ + type: UPDATE_LANGUAGE, + payload: language + }); + }; +}; diff --git a/src/redux/preference/reducer.js b/src/redux/preference/reducer.js index a72c8b2..8c1819f 100644 --- a/src/redux/preference/reducer.js +++ b/src/redux/preference/reducer.js @@ -1,7 +1,8 @@ -import { RESET_OPTIONS, UPDATE_OPTIONS, UPDATE_VIEW_TYPE } from './types'; +import { RESET_OPTIONS, UPDATE_LANGUAGE, UPDATE_OPTIONS, UPDATE_VIEW_TYPE } from './types'; const initialState = { - view: 'grid', + viewType: 'grid', + language: '', options: { token: '', }, @@ -22,7 +23,12 @@ export default function reducer(state = initialState, action) { case UPDATE_VIEW_TYPE: return { ...state, - view: action.payload + viewType: action.payload + }; + case UPDATE_LANGUAGE: + return { + ...state, + language: action.payload }; default: return state; diff --git a/src/redux/preference/types.js b/src/redux/preference/types.js index 84e1f8b..9874e13 100644 --- a/src/redux/preference/types.js +++ b/src/redux/preference/types.js @@ -1,3 +1,4 @@ export const UPDATE_OPTIONS = 'UPDATE_OPTIONS'; export const RESET_OPTIONS = 'RESET_OPTIONS'; export const UPDATE_VIEW_TYPE = 'UPDATE_VIEW_TYPE'; +export const UPDATE_LANGUAGE = 'UPDATE_LANGUAGE'; |
