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", "name": "example-layout-transitions",
"dependencies": { "dependencies": {
"axios": "^0.19.0",
"nuxt": "latest" "nuxt": "latest"
}, },
"scripts": { "scripts": {

View File

@ -30,12 +30,10 @@
</template> </template>
<script> <script>
import axios from 'axios'
export default { export default {
async asyncData ({ query }) { async asyncData ({ query }) {
const page = +(query.page || 1) 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 { return {
page, page,
totalPages: data.total_pages, totalPages: data.total_pages,

View File

@ -28,8 +28,6 @@
</template> </template>
<script> <script>
import axios from 'axios'
export default { export default {
// Watch for $route.query.page to call Component methods (asyncData, fetch, validate, layout, etc.) // Watch for $route.query.page to call Component methods (asyncData, fetch, validate, layout, etc.)
watchQuery: ['page'], watchQuery: ['page'],
@ -42,7 +40,7 @@ export default {
}, },
async asyncData ({ query }) { async asyncData ({ query }) {
const page = +(query.page || 1) 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 { return {
page, page,
totalPages: data.total_pages, totalPages: data.total_pages,