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> <script>
export default { export default {
data () { asyncData () {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => resolve({ name: 'Nuxt.js' }), 10) setTimeout(() => resolve({ name: 'Nuxt.js' }), 10)
}) })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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