Skip to content

Instantly share code, notes, and snippets.

@yogieputra8
Created February 6, 2018 14:08
Show Gist options
  • Save yogieputra8/9005b977a668e6c114477ea54d51dbf2 to your computer and use it in GitHub Desktop.
Save yogieputra8/9005b977a668e6c114477ea54d51dbf2 to your computer and use it in GitHub Desktop.
import axios from 'axios'
export const FETCH_DATA = 'FETCH_DATA'
export const fetchData = () => {
return {
type: FETCH_DATA
}
}
export const FETCH_BANNERS = 'FETCH_BANNERS'
export const fetchBanners = () => {
return {
type: FETCH_BANNERS,
payload: getBanner()
}
}
const getBanner = async () => {
const url_banners = `http://172.104.50.9:3000/api/banner_lists`
return axios.get(url_banners)
.then(res => {
console.log(res.data)
return res.data
})
.catch(err => {
console.log(err)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment