Redux: data disappear after page refresh

I am getting data from REST API in my actions like this

const getEmailFooter = () => async (dispatch) => {
  try {
    const response = await api.get("/signatures");

    return dispatch({
      type: "GET_EMAIL_FOOTER",
      payload: response.data,
    });
  } catch (error) {
    throw dispatch({
      type: "GET_EMAIL_FAILED",
      payload: error.data,
    });
  }
};

and I am displaying this data in one of my components like this

  ......
   const signatures = useSelector((state) => state.videoFooterReducer);
   .......
   
  useEffect(() => {
    getEmailSignatures();
  }, []);

  const getEmailSignatures = async (signatures) => {
    try {
      dispatch(actions.videoFooterActions.getEmailFooter);
    } catch (error) {}
  };
  
  
 return(
    <div>
         {signatures.map((signature) => (
            <SignatureListTemplate signature={signature} key={signature.id} />
          ))}
    </div>
 );

unfortunately, data disappear after page refresh, what is wrong here?



Read more here: https://stackoverflow.com/questions/67937680/redux-data-disappear-after-page-refresh

Content Attribution

This content was originally published by The Dead Man at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: