import * as constants from '../constants/ActionTypes'

export default function user (state = {username: null}, action) {
  switch (action.type) {
  case constants.USER_LOGGED_IN:
    state = {
      username: action.username
    }
    return state
  case constants.USER_LOGGED_OUT:
    state = {
      username: null
    }
    return state
  default:
    return state
  }
}

import * as constants from '../constants/ActionTypes'

const initialState = {
  details: null,
  repos: []
}

export default function user (state = initialState, action) {
  switch (action.type) {
  case constants.USER_LOGGED_IN:
    state = {
      details: action.details,
      repos: action.repos
    }
    return state
  case constants.USER_LOGGED_OUT:
    state = initialState
    return state
  default:
    return state
  }
}

add initial state & reference repos action