Skip to content

Instantly share code, notes, and snippets.

@faceyspacey
Created August 10, 2017 07:37
Show Gist options
  • Select an option

  • Save faceyspacey/2357906c8582e1df1a4e5f7aa5c17aa8 to your computer and use it in GitHub Desktop.

Select an option

Save faceyspacey/2357906c8582e1df1a4e5f7aa5c17aa8 to your computer and use it in GitHub Desktop.
const routesMap = {
HOME: '/',
LIST: {
path: '/list/:category',
thunk: async (dispatch, getState) => {
const { payload: { category } } = getState().location
const videos = await fetchData(`/api/videos/${category}`)
dispatch({ type: 'VIDEOS_FETCHED', payload: { videos, category } })
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment