addUser.js 1.69 KB
import { notifyError } from '../services/app.js';
import { addUser,Dictionaries,sendMaster,isFollow,followCustomer} from '../services/addUser';





export default {
  namespace: 'addUser',
  state: {

  },
  effects: {

    *addUser({ payload,callback,error}, { call, put }) {
      const { data } = yield call(addUser, payload);
      if (data.status) {
        if (callback) callback(data);
      } else {
        // if (error) callback(error);
        if (error) error(data);

      }
    },
    *Dictionaries({ payload, callback }, { call, put }) {
      const { data } = yield call(Dictionaries, payload);
      if (data.status) {

        if (callback) callback(data.data);
      } else {
        notifyError(data.message);
      }
    },

    *sendMaster({ payload, callback,error }, { call, put }) {
      console.log(payload);
      const { data } = yield call(sendMaster, payload);
      if (data.status) {
        if (callback) callback(data.data);
      } else {
        if (error) error(data.data);
        // notifyError(data.message);
      }
    },

    *isFollow({ payload, callback,error }, { call, put }) {
      console.log(payload);
      const { data } = yield call(isFollow, payload);
      if (data.status) {
        if (callback) callback(data.data);
      } else {
        if (error) error(data.data);
        // notifyError(data.message);
      }
    },

    *followCustomer({ payload, callback,error }, { call, put }) {
      console.log(payload);
      const { data } = yield call(followCustomer, payload);
      if (data.status) {
        if (callback) callback(data.data);
      } else {
        if (error) error(data.data);
      }
    }





  },
  reducers: {

  },
  subscriptions: {

  },
};