export default function(state = {}, action) {
  switch (action.type) {
    case 'INIT-ROUTE':
      return {
        ...state,
        rootPattern: new URL(action.path).pathname
      }

    case 'SET-PAGE-AND-ID':
      let route = action.route

      return {
        ...state,
        page: route.page || 'list-by-group',
        id: route.id
      }

    default:
      return state
  }
}
