Skip to main content

getActionType

传入仓库名字,获得对应 action 的名字,action 包括同步的 reducer 和异步的 thunk。

用法

import { createMatcher } from "redux-eazy";
import { dp, getActionType } from "../..";
import { startAppListening } from "../../setup";

const watch = () => {
startAppListening({
type: getActionType("appStore").setPagination,
effect: async () => {
dp("appStore", "queryAct");
},
});
};

export default watch;

参数

  • storeName (string): 仓库名称。例如,"appStore"。

返回

  • action的name (string),如果是 Reducer,那就是对应的 type 字符,比如“appStore/setTestValue”
  • thunk的字符对象:如果是 Thunk,那就是一个对象,包含一下三种属性,值都是字符
    • fulfilled(string):该 thunk 的 fulfilled 字符
    • pending(string):该 thunk 的 pending 字符
    • rejected(string):该 thunk 的 rejected 字符