Init UI changes, cleanup
This commit is contained in:
parent
9da5097068
commit
2725e366a2
20 changed files with 206 additions and 274 deletions
38
frontend/src/redux/reducers.js
Normal file
38
frontend/src/redux/reducers.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
const defaultState = {
|
||||
isAuthenticated: false,
|
||||
user: null,
|
||||
i18n: null,
|
||||
langs: null,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line default-param-last
|
||||
export default (state = defaultState, action) => {
|
||||
switch (action.type) {
|
||||
case 'SET_USER':
|
||||
return {
|
||||
...state,
|
||||
user: {
|
||||
...action.user,
|
||||
},
|
||||
isAuthenticated: true,
|
||||
};
|
||||
case 'CLEAR_USER':
|
||||
return {
|
||||
...state,
|
||||
user: null,
|
||||
isAuthenticated: false,
|
||||
};
|
||||
case 'SET_I18N':
|
||||
return {
|
||||
...state,
|
||||
i18n: action.data,
|
||||
};
|
||||
case 'SET_LANGS':
|
||||
return {
|
||||
...state,
|
||||
langs: action.data,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
4
frontend/src/redux/store.js
Normal file
4
frontend/src/redux/store.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { createStore } from 'redux';
|
||||
import Reducer from './reducers';
|
||||
|
||||
export default createStore(Reducer);
|
||||
Loading…
Reference in a new issue