Update usage.md

master
Sébastien Chopin 2018-11-03 11:24:44 +09:00 committed by GitHub
parent 461ab812a5
commit e5f132f491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 12 deletions

View File

@ -5,8 +5,8 @@
**`asyncData`**
```js
async asyncData({ app }) {
const ip = await app.$axios.$get('http://icanhazip.com')
async asyncData({ $axios }) {
const ip = await $axios.$get('http://icanhazip.com')
return { ip }
}
```
@ -22,16 +22,7 @@ methods: {
}
```
### Store `nuxtServerInit`
```js
async nuxtServerInit ({ commit }, { app }) {
const ip = await app.$axios.$get('http://icanhazip.com')
commit('SET_IP', ip)
}
```
### Store actions
### Store actions (including `nuxtServerInit`)
```js
// In store