Skip to content

Instantly share code, notes, and snippets.

@radiegtya
Created May 13, 2018 03:09
Show Gist options
  • Save radiegtya/7d86422c987af3da864fad979f99ee8d to your computer and use it in GitHub Desktop.
Save radiegtya/7d86422c987af3da864fad979f99ee8d to your computer and use it in GitHub Desktop.
// #1. import axios here to fetch data
import axios from 'axios'
// #2. make a function called getProfile as an action
export function getProfile(){
const url = `https://api.backendless.com/221BAB21-F149-D2B2-FF55-B2DD8ECDFE00/31717453-DFFE-7469-FF91-D1EAC0C16700/data/profiles/564DD7D4-4F12-B56A-FFD5-1E4B0E7D9D00?loadRelations=experiences%2Ceducations`
return {
type: 'GET_PROFILE', //#3. we call our type GET_PROFILE, so reducer can choose what state should we return
payload: axios.get(url) //#4. we'll using redux-promise-middleware, so what we return are a promises
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment