function* outputActionPostDepartment(action) {
  console.log("Monitoring The Saga for Post Department Success");
  // read the payload of the input dispatched action
  const dept = action.department;
  console.log(`Received data fro Post is = ${JSON.stringify(dept)}`);
  try {
    // call the method
    const response = yield call(postDepartment, dept);
    console.log(`Response after POST is = ${JSON.stringify(response)}`);
    yield put({
      type: "ADD_DEPARTMENT_SUCCESS",
      department: response.data,
      message: 'New Department is Added Successfully'
    });
  } catch (e) {
    yield put({
      type: "ADD_DEPARTMENT_FAILED",
      department: `Add  new department is failed ${e.message}`,
    });
  }
}
// the return value from the dispatched action
the return value from the dispatched action
the return value from the dispatched action
function* outputActionPostDepartment(action) {
  console.log("Monitoring The Saga for Post Department Success");
  const dept = action.department;
  console.log(`Received data fro Post is = ${JSON.stringify(dept)}`);
  try {
    const response = yield call(postDepartment, dept);
    console.log(`Response after POST is = ${JSON.stringify(response)}`);
    yield put({
      type: "ADD_DEPARTMENT_SUCCESS",
      department: response.data,
      message: 'New Department is Added Successfully'
    });
  } catch (e) {
    yield put({
      type: "ADD_DEPARTMENT_FAILED",
      department: `Add  new department is failed ${e.message}`,
    });
  }
}
function * outputActionPostDepartment ( action ) { console . log ( "Monitoring The Saga for Post Department Success" ) ; const dept = action . department ; console . log ( ` ${ JSON . stringify ( dept ) } ` ) ; try { const response = yield call ( postDepartment , dept ) ; console . log ( ` ${ JSON . stringify ( response ) } ` ) ; yield put ( { type : "ADD_DEPARTMENT_SUCCESS" , department : response . data , message : 'New Department is Added Successfully' } ) ; } catch ( e ) { yield put ( { type : "ADD_DEPARTMENT_FAILED" , department : ` ${ e . message } ` , } ) ; } }
the return value from the dispatched action
the return value from the dispatched action
// read the payload of the input dispatched action // call the method