Created
July 13, 2017 06:41
-
-
Save jtulk/41233fcf15136d8b154e93d620aaa836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ACTIONS } from './actions'; | |
// Log if a fetch is aborted by the async call running too aggressively. | |
export const abortFetch = () => ({ | |
type: ACTIONS.abort | |
}); | |
/** | |
* Log an error if the async call fails | |
* @param {object} error - the error thrown. | |
*/ | |
export const errorFetch = error => ({ | |
type: ACTIONS.error, | |
error | |
}); | |
// Start the fetch, toggle is `isFetching` value | |
export const startFetch = () => ({ | |
type: ACTIONS.start | |
}); | |
/** | |
* Resolve the fetch with the returned data | |
* @param {object} payload - the data returned from the fetch | |
*/ | |
export const updateFetch = payload => ({ | |
type: ACTIONS.update, | |
payload | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment