Last active
May 27, 2018 18:42
-
-
Save gaurav-gogia/b411659baf001cfb49d52137f901f254 to your computer and use it in GitHub Desktop.
How do I use async/await functions in actions?
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 axios from 'axios'; | |
import {ACTION_TYPES, URL} from '../constants'; | |
export const getAnimals = () => { | |
//code for use below async function to get the data and use it as payload | |
return { | |
type: ACTION_TYPES.GET_ANIMALS, | |
payload: {} | |
} | |
} | |
const getAnimalsAsync = async () => await axios.get(URL.GET_ANIMAL_LIST); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: