actionUsersSearchPage.js 673 B

123456789101112131415
  1. import { put, take } from "redux-saga/effects";
  2. import { actionFeedClear, actionFeedUsersFind, actionPromiseClear } from "../reducers";
  3. export const actionUsersSearchPage = ({ orderBy = "_id", text = "" } = {}) => ({ type: "USERS_SEARCH_PAGE", payload: { orderBy, text } });
  4. export function* usersSearchPageWorker(action) {
  5. const { orderBy = "_id", text = "" } = action.payload || {};
  6. yield put(actionFeedClear());
  7. yield put(actionPromiseClear("feedUsersFind"));
  8. yield put(actionFeedUsersFind({ skip: 0, orderBy, text }));
  9. yield take("USERS_SEARCH_PAGE_CLEAR");
  10. yield put(actionFeedClear());
  11. yield put(actionPromiseClear("feedUsersFind"));
  12. }