Language as window.language for access in pure function
This commit is contained in:
@ -69,6 +69,13 @@ export function setWindowFocus(window_focus) {
|
||||
};
|
||||
}
|
||||
|
||||
export function setLanguage(language) {
|
||||
return {
|
||||
type: 'SET_LANGUAGE',
|
||||
language,
|
||||
};
|
||||
}
|
||||
|
||||
export function hideContextMenu() {
|
||||
return {
|
||||
type: 'HIDE_CONTEXT_MENU',
|
||||
|
||||
@ -3,9 +3,6 @@ import ReactGA from 'react-ga';
|
||||
const uiActions = require('./actions.js');
|
||||
|
||||
const UIMiddleware = (function () {
|
||||
/**
|
||||
* The actual middleware inteceptor
|
||||
* */
|
||||
return (store) => (next) => (action) => {
|
||||
switch (action.type) {
|
||||
case 'MOPIDY_STATE':
|
||||
@ -252,6 +249,12 @@ const UIMiddleware = (function () {
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'SET_LANGUAGE':
|
||||
const { language } = action;
|
||||
window.language = language;
|
||||
store.dispatch(uiActions.set({ language }));
|
||||
break;
|
||||
|
||||
// This action is irrelevant to us, pass it on to the next middleware
|
||||
default:
|
||||
return next(action);
|
||||
|
||||
Reference in New Issue
Block a user