From c3597e1841543059cc80417f411bf103d3bf4561 Mon Sep 17 00:00:00 2001 From: Jokcy Date: Thu, 8 Dec 2016 18:40:42 +0800 Subject: [PATCH] update testing doc: commit to mutation not dispatch --- docs/en/testing.md | 6 +++--- docs/fr/testing.md | 6 +++--- docs/ja/testing.md | 6 +++--- docs/ru/testing.md | 6 +++--- docs/zh-cn/testing.md | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/en/testing.md b/docs/en/testing.md index 55098ca18..9bb0e73ad 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -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) }) } ``` diff --git a/docs/fr/testing.md b/docs/fr/testing.md index 0522b50dc..88e1a4eaf 100644 --- a/docs/fr/testing.md +++ b/docs/fr/testing.md @@ -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) }) } ``` diff --git a/docs/ja/testing.md b/docs/ja/testing.md index fe82154ea..dc8770f5a 100644 --- a/docs/ja/testing.md +++ b/docs/ja/testing.md @@ -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) }) } ``` diff --git a/docs/ru/testing.md b/docs/ru/testing.md index 8fdc9e786..3edba1b27 100644 --- a/docs/ru/testing.md +++ b/docs/ru/testing.md @@ -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) }) } ``` diff --git a/docs/zh-cn/testing.md b/docs/zh-cn/testing.md index 056d56816..26a415dc6 100644 --- a/docs/zh-cn/testing.md +++ b/docs/zh-cn/testing.md @@ -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) }) } ```