Skip to content

update testing doc: commit to mutation not dispatch #512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/en/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Example testing an async action:
// actions.js
import shop from '../api/shop'

export const getAllProducts = ({ dispatch }) => {
dispatch('REQUEST_PRODUCTS')
export const getAllProducts = ({ commit }) => {
commit('REQUEST_PRODUCTS')
shop.getProducts(products => {
dispatch('RECEIVE_PRODUCTS', products)
commit('RECEIVE_PRODUCTS', products)
})
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/fr/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Exemple de test d'une action asynchrone :
// actions.js
import shop from '../api/shop'

export const getAllProducts = ({ dispatch }) => {
dispatch('REQUEST_PRODUCTS')
export const getAllProducts = ({ commit }) => {
commit('REQUEST_PRODUCTS')
shop.getProducts(products => {
dispatch('RECEIVE_PRODUCTS', products)
commit('RECEIVE_PRODUCTS', products)
})
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/ja/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ describe('mutations', () => {
// actions.js
import shop from '../api/shop'

export const getAllProducts = ({ dispatch }) => {
dispatch('REQUEST_PRODUCTS')
export const getAllProducts = ({ commit }) => {
commit('REQUEST_PRODUCTS')
shop.getProducts(products => {
dispatch('RECEIVE_PRODUCTS', products)
commit('RECEIVE_PRODUCTS', products)
})
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/ru/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ describe('mutations', () => {
// actions.js
import shop from '../api/shop'

export const getAllProducts = ({ dispatch }) => {
dispatch('REQUEST_PRODUCTS')
export const getAllProducts = ({ commit }) => {
commit('REQUEST_PRODUCTS')
shop.getProducts(products => {
dispatch('RECEIVE_PRODUCTS', products)
commit('RECEIVE_PRODUCTS', products)
})
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/zh-cn/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Actions 应对起来略微棘手,因为它们可能需要调用外部的 API
// actions.js
import shop from '../api/shop'

export const getAllProducts = ({ dispatch }) => {
dispatch('REQUEST_PRODUCTS')
export const getAllProducts = ({ commit }) => {
commit('REQUEST_PRODUCTS')
shop.getProducts(products => {
dispatch('RECEIVE_PRODUCTS', products)
commit('RECEIVE_PRODUCTS', products)
})
}
```
Expand Down