Skip to content

Instantly share code, notes, and snippets.

@vzaidman
Created December 8, 2017 11:58
Show Gist options
  • Save vzaidman/ce3272d87767e07d77f8dca0d4422e80 to your computer and use it in GitHub Desktop.
Save vzaidman/ce3272d87767e07d77f8dca0d4422e80 to your computer and use it in GitHub Desktop.
import { fetchOrders } from './actions'
export const vanilaReducerWithToolbeltAction = (state = {}, action) => {
switch(action.type):
case fetchOrders.TYPE:
return { loading: true }
case fetchOrders.success.TYPE:
return { loading: false, data: action.payload }
case fetchOrders.failure.TYPE:
return { loading: false, error: action.payload }
default:
return state
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment