{"size": 932, "ext": "js", "max_stars_repo_path": "src/routes/Search/modules/search.js", "max_stars_repo_name": "Galloa118/react_redux_project", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/routes/Search/modules/search.js", "max_issues_repo_name": "Galloa118/react_redux_project", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/routes/Search/modules/search.js", "max_forks_repo_name": "Galloa118/react_redux_project", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.3, "max_line_length": 69, "alphanum_fraction": 0.4495708155}
// ------------------------------------
// Constants
// ------------------------------------
const MOVETOSEARCHPAGE = 'MOVETOSEARCHPAGE'
// ------------------------------------
// Actions
// ------------------------------------

export const moveToPage = page => ({
  type: MOVETOSEARCHPAGE,
  value: page
})

// ------------------------------------
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
  [MOVETOSEARCHPAGE]: (state, action) => ({
    ...state,
    pageNumber: action.value
  }),
  ['HANDLE_SEARCHGRID_FORM_SUBMIT']: (state, action) => ({
    ...initialState
  })
}
// ------------------------------------
// Reducer
// ------------------------------------

const initialState = {
  pageNumber: 0,
  perPage: 9
}

export default function searchReducer(state = initialState, action) {
  const handler = ACTION_HANDLERS[action.type]

  return handler ? handler(state, action) : state
}
