nuxt-community / feed-module

Everyone deserves RSS, ATOM and JSON feeds!
MIT License
227 stars 36 forks source link

Example typo #7

Closed Youdaman closed 5 years ago

Youdaman commented 5 years ago

Where you have:

  const posts = await axios.get('https://blog.lichter.io/posts/').data

Should be:

  const posts = (await axios.get('https://blog.lichter.io/posts/')).data

i.e. extra parens around the await/get so it resolves before you try accessing .data (as per other examples below it)

Youdaman commented 5 years ago

Also, that URL might not be a good example as it doesn't return JSON but rather returns a HTML page.

manniL commented 5 years ago

Thanks @Youdaman ☺️ I've changed the URLs and fixed the code

Youdaman commented 5 years ago

Thank you! The only other thing I'd suggest is similiar to https://github.com/nuxt-community/feed-module/issues/1 maybe add the axios require line above the usage, e.g.

const axios = require('axios')
const posts = await (axios.get('https://api.blog.lichter.io/posts')).data

That way readers can do a straight copy/paste without needing to find that issue.

manniL commented 5 years ago

Done 👌 Thanks a lot for you suggestions!