Last active
May 10, 2020 18:43
-
-
Save vanaf1979/ed8259ef84c7420a5a389f79995b2929 to your computer and use it in GitHub Desktop.
Setup Axios for the WordPress Rest Api https://since1979.dev/snippet-014-setup-axios-for-the-wordpress-rest-api/
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 local dependencies | |
*/ | |
import Api from './api.js'; | |
/* | |
* Use the Axios Api object to call the /wp/v2/posts | |
* endpoint and retrieve the 10 latest posts. | |
*/ | |
Api.get('/wp/v2/posts', {}).then(function (response) { | |
console.log(response.data); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment