mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
chore(example): remove usage of axios in layout-transitions
This commit is contained in:
parent
61e93d01f9
commit
dfaa1960f7
@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "example-layout-transitions",
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
"nuxt": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user