Created
June 13, 2017 11:00
-
-
Save yann-yinn/92a219f491754551fd760e99312c3cf7 to your computer and use it in GitHub Desktop.
Get data property from response returned by Axios
This file contains hidden or 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
const endpoint = 'https://public-api.wordpress.com/wp/v2/sites/yineo.fr' | |
const axios = require('axios') | |
async getPosts (perPage = 10) { | |
return {data} = await axios.get(endpoint + '/posts?_embed&per_page=' + perPage) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment