Init UI changes, cleanup

This commit is contained in:
oitsjustjose 2022-04-15 10:47:34 -05:00
commit 2725e366a2
20 changed files with 206 additions and 274 deletions

View 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;
}
};

View file

@ -0,0 +1,4 @@
import { createStore } from 'redux';
import Reducer from './reducers';
export default createStore(Reducer);