score:4

Accepted answer

just pass it with the action. the parts to be changed:
actions

export function getdata(id) {
  return { type: "data_requested", payload:{id} };
}

saga

function* workersaga(action) {
  try {
    const payload = yield call(getdata,action.payload.id);
    yield put({ type: "data_loaded", payload });
  } catch (e) {
    yield put({ type: "api_errored", payload: e });
  }

getdata


export function getdata(input_id) {
  return axios
    .get(global.baseurl,{id:input_id})
    .then(response => {
      console.log("response data:", response.data);
      return response.data;
    })
    .catch(error => {
      console.log(
        "123-------------network error to be solved--------------------"
      );
      return error;
    });
}

you might need to change some more stuff to get a fully working code but this is the general way to achieve what you want.


Related Query

More Query from same tag