Skip to content

Instantly share code, notes, and snippets.

@donjajo
Created March 18, 2017 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donjajo/ab6cce131f8dc8ed5623ae32c3af14cf to your computer and use it in GitHub Desktop.
Save donjajo/ab6cce131f8dc8ed5623ae32c3af14cf to your computer and use it in GitHub Desktop.
export function load_cat_names() {
return dispatch => {
return fetch( '/?token=' + vitals.token, {
method : 'POST',
headers : {
'X-Requested-With' : 'XMLHttpRequest'
},
body : JSON.stringify({ action : 'cat_names' }),
credentials : 'same-origin'
})
.then( response => response.json() )
.then( json => {
console.log( json.data );
dispatch( loaded_cat_names( json ) )
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment