1. 19
    Use Axios for Remote Data Fetching with Vue Mounted Property
    1m 18s

Use Axios for Remote Data Fetching with Vue Mounted Property

Share this video with your friends

Send Tweet

We'll see how we can use the mounted property of the configuration object to fetch data for our applications. We will set initial props and then have these updated with the returned data from our HTTP call.

Philip
Philip
~ 3 years ago

It would be great if a full URL was provided for the get to see it work locally. In the video the full URL is not visible.

Lucas Minter
Lucas Minter
~ 3 years ago

Hey Philip! I've found the github url I believe you were asking for.

Kevin Cunningham
Kevin Cunninghaminstructor
~ 3 years ago

Sorry for the delay! Lucas is exactly right, that's the file in question. However, this url responds with raw json: https://raw.githubusercontent.com/doingandlearning/vue-fundamentals/main/data.json

Hope that's helpful and sorry it wasn't clearer on the video!

Philip
Philip
~ 3 years ago

@Lucas @Kevin Thank you!! While it was clear what was going on in the lesson, it's still nice to see it in action locally ;)

DevMonks
DevMonks
~ 3 years ago

Thanks everyone! If you use this: 'https://raw.githubusercontent.com/doingandlearning/vue-fundamentals/main/data.json' the data will come in response.data so:

axios.get('https://raw.githubusercontent.com/doingandlearning/vue-fundamentals/main/data.json').then( response => this.ticketTypes = response.data )

Hope someone find this useful :)