mirror of https://github.com/sundowndev/http.git
Update usage.md
parent
461ab812a5
commit
e5f132f491
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue