update test for asyncData

This commit is contained in:
Alexandre Chopin 2017-03-01 16:03:46 +01:00
parent 6773c98d28
commit 9dfe293bd0
8 changed files with 8 additions and 8 deletions

View File

@ -4,7 +4,7 @@
<script>
export default {
data () {
asyncData () {
return new Promise((resolve) => {
setTimeout(() => resolve({ name: 'Nuxt.js' }), 10)
})

View File

@ -10,7 +10,7 @@ const fetchData = () => {
}
export default {
async data () {
async asyncData () {
return await fetchData()
}
}

View File

@ -4,7 +4,7 @@
<script>
export default {
async data (context, callback) {
async asyncData (context, callback) {
setTimeout(function () {
callback(null, { name: 'Callback Nuxt.js' })
}, 10)

View File

@ -4,7 +4,7 @@
<script>
export default {
data () {
asyncData () {
throw new Error('Error mouahahah')
}
}

View File

@ -4,7 +4,7 @@
<script>
export default {
data ({ error }) {
asyncData ({ error }) {
error({ message: 'Custom error' })
}
}

View File

@ -4,7 +4,7 @@
<script>
export default {
data ({ params }) {
asyncData ({ params }) {
return { id: params.id }
}
}

View File

@ -5,7 +5,7 @@
<script>
export default {
layout: 'custom-env',
data ({ env }) {
asyncData ({ env }) {
return { env }
}
}

View File

@ -5,7 +5,7 @@
<script>
export default {
middleware: 'user-agent',
data ({ userAgent }) {
asyncData ({ userAgent }) {
return { userAgent }
}
}