import ActionTypes from '../actionTypes';

const initialState = {
  loggedIn: false,
  email: undefined,
  roles: [],
  authService: undefined,
};

export default function auth(state = initialState, { type, data }) {
  switch (type) {
    case ActionTypes.AUTH_SERVICE_CREATED:
      return Object.assign({}, state, {
        authService: data,
      });
    case ActionTypes.LOGGED_IN:
      return Object.assign({}, state, {
        loggedIn: true,
        email: data.email,
        roles: Array.from(data.roles),
      });
    case ActionTypes.LOGGED_OUT:
      return Object.assign({}, state, {
        loggedIn: false,
        email: initialState.email,
        roles: initialState.roles,
      });
    default:
      return state;
  }
}

@@ -490,19 +490,8 @@
 es: 
-Array.from(
 data
@@ -496,17 +496,16 @@
 ta.roles
-)
 ,%0A      

remove workaround