Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3396 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3719 stevensc 1
import { actionsTypes } from './auth.types';
2
 
3
const initialState = {
4
  access_usign_social_networks: 'y',
5
  aes: '',
6
  defaultNetwork: 'y',
7
  email: '',
8
  favico_url: '',
9
  intro: '',
10
  logo_url: '',
11
  navbar_url: '',
12
  remember: true,
13
  site_key: '',
14
  is_logged_in: false,
15
  theme_id: '1',
16
  jwt: '',
17
  loading: true
18
};
19
 
20
const AuthReducer = (state = initialState, action) => {
21
  const { type, payload } = action;
22
 
23
  const actionCases = {
24
    [actionsTypes.SET_CREDENTIALS]: { ...state, ...payload },
25
    [actionsTypes.LOGIN]: { ...state, is_logged_in: true },
26
    [actionsTypes.LOGOUT]: { ...state, is_logged_in: false },
27
    [actionsTypes.START_LOADING]: { ...state, loading: true },
28
    [actionsTypes.STOP_LOADING]: { ...state, loading: false }
29
  };
30
 
31
  return actionCases[type] || state;
32
};
33
 
34
export default AuthReducer;