import {combineReducers} from 'redux'

import Action from '../action'

function profile(state = {}, action) {
  switch (action.type) {
    case Action.User.profile.type:
      return action.profile
    default:
      return state
  }
}

function preferences(state = {}, action) {
  switch (action.type) {
    case Action.User.preferences.type:
      return {
        listenOnly: false,
        connection: 0,
        theme: 0,
        ...action.preferences
      }
    default:
      return state
  }
}

export default combineReducers({
  profile,
  preferences
})

@@ -30,16 +30,47 @@
  'redux'
+%0Aimport %7BisEmpty%7D from 'lodash'
 %0A%0Aimport
@@ -283,29 +283,24 @@
 rences(state
- = %7B%7D
 , action) %7B%0A
@@ -290,32 +290,151 @@
 state, action) %7B
+%0A  const defaults = %7B%0A    listenOnly: false,%0A    connection: 0,%0A    theme: 0%0A  %7D%0A  if (isEmpty(state)) state = defaults
 %0A  switch (actio
@@ -509,66 +509,16 @@
     
-listenOnly: false,%0A        connection: 0,%0A        theme: 0
+...state
 ,%0A  

fix default preferences