I made a post request to this url http://localhost:8000/api/auth/users/ on postman . It was successful. However, trying the same thing on my react front end produces a 400 (bad request error). It also says Uncaught (in promise) Error: Request failed with status code 400
Here's my code AuthAPi.js:
import API from "./API";
const config = {
headers :{
"Content-Type": "application/json",
}
}
const signIn = (email, password) => API.post("/auth/users/", {
params : {
email : email,
password : password
},
},
config
)
.Catch((error) => console.log( error.message ) );
export { signIn };
and API.js
import axios from 'axios';
export default axios.create({
baseURL: `http://127.0.0.1:8000/api`,
headers: {
"Content-type": "application/json"
}
});
I've tried several links without solutions. I'd be glad to get assistance here.
There is below a screenshot a console log, Network log and Django server log:




