chore(example): remove usage of axios in layout-transitions

This commit is contained in:
Sébastien Chopin 2020-10-06 12:43:05 +02:00
parent 61e93d01f9
commit dfaa1960f7
3 changed files with 2 additions and 7 deletions

View File

@ -1,7 +1,6 @@
{
"name": "example-layout-transitions",
"dependencies": {
"axios": "^0.19.0",
"nuxt": "latest"
},
"scripts": {

View File

@ -30,12 +30,10 @@
</template>
<script>
import axios from 'axios'
export default {
async asyncData ({ query }) {
const page = +(query.page || 1)
const { data } = await axios.get(`https://reqres.in/api/users?page=${page}`)
const data = await fetch(`https://reqres.in/api/users?page=${page}`).then(res => res.json())
return {
page,
totalPages: data.total_pages,

View File

@ -28,8 +28,6 @@
</template>
<script>
import axios from 'axios'
export default {
// Watch for $route.query.page to call Component methods (asyncData, fetch, validate, layout, etc.)
watchQuery: ['page'],
@ -42,7 +40,7 @@ export default {
},
async asyncData ({ query }) {
const page = +(query.page || 1)
const { data } = await axios.get(`https://reqres.in/api/users?page=${page}`)
const data = await fetch(`https://reqres.in/api/users?page=${page}`).then(res => res.json())
return {
page,
totalPages: data.total_pages,