LoginSignup
15
6

More than 5 years have passed since last update.

Vuexのアクションをアクションの中から呼ぶ

Posted at

Vuexのアクションをアクションの中から呼ぶときは、dispatch をアクションのパラメータで受けとって、そのdispatch経由でアクションを呼びます。

export default {
    update({ dispatch, commit, state }, itemId) {
        api.update(
            itemId,
            () => {
                dispatch('search', state.current_condition);
            },
            errors => {

            }
        );
    }
}

これだけ。

15
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
6