Skip to content
Advertisement

Using Axios instead of fetch for http get requests with Vue App

The following vue app should get some data from a firebase instance using the fetch method and display the data on the page.

UserExperiences.vue

JavaScript

SurveyResult.vue

JavaScript

The data renders on the webpage correctly on the webpage using the fetch method. Is there a way to use axios.get instead? I’ve tried using the mounted vue property and it gets the data to appear on a blank screen in a json format, but I want the data to render on the webpage with the stylings and other vue components together.

This is what the page should look like for context: enter image description here

Advertisement

Answer

As long as you do the same transformation of the result (your results.push({ ... }) part), you should get the same result.

You can simplify it like this

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement