0

I have deployed heroku app that is based on Django, and React but whenever i want to login into the deployed app i'm getting an error

POST http://localhost:8000/api/auth/jwt/create/ net::ERR_CONNECTION_REFUSED

Initially i had my react login api as http://localhost:8000/api/auth/jwt/create/ then changed it to http://127.0.0.1:8000/api/auth/jwt/create/ but i keep getting the same error.

login file in react

// LOGIN
export const login = (email, password) => async (dispatch) => {
  const body = JSON.stringify({ email, password });

  await axios
    .post("http://127.0.0.1:8000/api/auth/jwt/create/", body)
    .then((res) => {
      try {        
        dispatch({
          type: LOGIN_SUCCESS,
          payload: res.data,
        });
        dispatch(createMessage({ login: "Login Successful" }));
      } catch (error) {
        console.log(res, error);
      }
    })
    .catch((err) => {
      console.log(err);
      dispatch({
        type: LOGIN_FAIL,
      });
    });
}
Shadow Walker
  • 979
  • 5
  • 27
  • 51

0 Answers0