'Make HEAD call in Redux Saga React Typescript

I am trying to make a HEAD request and get a given header value using redux sagas.

Currently I have not gotten very far so I am looking for next steps.

I have also using Axios for the first time (normally fetch) so apologies if my syntax for Axios is also wrong!

Watch Saga:

function* CountSaga() {
  yield takeLatest(
    SearchActionTypeE.GET__COUNT,
    handleGetCount
  );
}

Handle: This is where I am stuck, not sure what to do with yield etc to get what I need from the response and then get the header value from this

function* handleGetCount() {
  try {
    const response: AxiosStatic = yield call(requestGetCount);
    setCount(data);
  } catch (error) {
    console.log(error);
  }
}

Request

function* requestGetCount() {
  
  const url = `xyz`;

  const config = {
    headers: {
      pragma: 'no-cache',
      'cache-control': 'no-cache',
    },
  };

  yield call(axios.head, url, config);
}

setCount is an action which sets the count to the store. Apologies if I am way off track I am new to redux! Cheers in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source