mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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",
|
"name": "example-layout-transitions",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.0",
|
|
||||||
"nuxt": "latest"
|
"nuxt": "latest"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user