All files / src/reducers user.js

100% Statements 11/11
77.78% Branches 7/9
100% Functions 4/4
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 271x 1x   1x     1x           1x             1x       1x      

export const reducers = {
  'log out' (state, action) {
    return {}
  },
  'set auth0 user' (state, action) {
    return {
      ...state,
      ...action.payload
    }
  },
  'set id token' (state, action) {
    return {
      ...state,
      idToken: action.payload
    }
  }
}
 
const localStorageAvailable = typeof window !== 'undefined' &&
  typeof window.localStorage !== 'undefined' &&
  typeof window.localStorage.getItem === 'function'
 
export const initialState = {
  ...JSON.parse(localStorageAvailable ? window.localStorage.getItem('user') : '{}')
}