Update example

This commit is contained in:
Sébastien Chopin 2017-07-08 18:05:44 +02:00
parent 209beb0677
commit 1f7508d033
2 changed files with 4 additions and 10 deletions

View File

@ -1,8 +1,7 @@
{
"name": "nuxt-async-data",
"description": "",
"dependencies": {
"axios": "^0.15.2",
"axios": "latest",
"nuxt": "latest"
},
"scripts": {

View File

@ -9,14 +9,9 @@
<script>
export default {
asyncData ({ req }, callback) {
setTimeout(function () {
// callback(err, data)
callback(null, {
userAgent: (req ? req.headers['user-agent'] : navigator.userAgent)
})
}, 100)
}
asyncData: ({ req }) => ({
userAgent: (req ? req.headers['user-agent'] : navigator.userAgent)
})
}
</script>