Files
plaidware-wms-web/src/sagas/Labelling.js
Llewellyn D'souza 30b4b5d7c2 fixed: unupdated state id for row
removed: unecessary dispatch action
Updated: label saga to listen to every dispatch
2022-03-08 17:47:36 +05:30

32 lines
915 B
JavaScript

import { AuthorizedAPI } from 'config';
import { call, put, takeEvery } from 'redux-saga/effects';
import LabellingActions from 'redux/LabellingRedux';
import { LabellingTypes } from 'redux/LabellingRedux';
import ApiServices from 'services/API/ApiServices';
export function* onRequestGetLabelData({ payload }) {
const response = yield call(
ApiServices[payload?.method],
AuthorizedAPI,
payload?.slug,
payload?.data
);
if (response?.status === 200) {
yield put(
LabellingActions.getLabelSuccess({
loader: payload?.loader,
getLabelDetail: response?.data?.data
})
);
} else {
payload.onFailedGetLabelData(response.data.error);
yield put(
LabellingActions.getLabelFailure({
loader: payload?.loader,
error: response?.data
})
);
}
}
export default [takeEvery(LabellingTypes.GET_LABEL_ACTION, onRequestGetLabelData)];