client/src/selectors/authSelectors.js
author salimr <riwad.salim@yahoo.fr>
Tue, 14 Aug 2018 20:39:55 +0200
changeset 144 8b950885ddae
parent 137 279e1dffa213
child 168 ea92f4fe783d
permissions -rw-r--r--
Add local font and assets. Override Bootstrap css varriables. Add specific css files

// Selectors linked to the authentication status

export const getOnline = state => state.getIn(["status", 'online'])

export const getToken = state => state.getIn(['authStatus','token'])

export const isAuthenticated = state => state.getIn(['authStatus', 'isAuthenticated'])

export const getCurrentUser = state => state.getIn(['authStatus', 'currentUser'])

export const getClientId = state => state.getIn(['authStatus', 'clientId'])

export const getCurrentGroupName = state => state.getIn(['authStatus', 'currentGroup'])

export const getGroups = state => state.get('groups')

export const getCurrentGroup = state => {
  const groupName = getCurrentGroupName(state);
  const groups = getGroups(state);
  if(groups) {
    return groups.find( g => g.get('name') === groupName );
  } else {
    return null;
  }
}

export const getCreateGroup = state => state.get('createGroup')

export const getAutoSubmit = state => state.get('autoSubmit')