actionGoodPage.js 466 B

123456789101112131415
  1. import { actionPromiseClear } from "../reducers";
  2. import { actionCatAll } from "./actionCatAll";
  3. import { actionGoodById } from "./actionGoodById";
  4. export const actionGoodPage =
  5. ({ _id, promiseName = "goodById" } = {}) =>
  6. async (dispatch, getState) => {
  7. dispatch(actionCatAll());
  8. if (_id) {
  9. dispatch(actionGoodById({ _id, promiseName }));
  10. } else {
  11. dispatch(actionPromiseClear(promiseName));
  12. }
  13. };