0

Cors error is showing not getting what is problem same thing is working fine in reactnative but not in reactjs
export const checkUser = () => { return async (dispatch) => { const token = getCookie("userToken"); const url =/auth/me`; const response = await api .post(url, { token }) .then((res) => { return res; }) .catch((error) => { return error.response; });

dispatch({
  type: "CHECK_USER",
  payload: response,
});

}; };
`

afshana zaman
  • 109
  • 1
  • 9
  • Does this answer your question? [Axios having CORS issue](https://stackoverflow.com/questions/50949594/axios-having-cors-issue) – Ergis Jan 17 '22 at 09:13

1 Answers1

0

Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources

Now , to overcome this issue one way is to allow your origin from server (PHP Example) , another approach is to setup proxy in your application