django-newsletter icon indicating copy to clipboard operation
django-newsletter copied to clipboard

Unable to call the subscribe api using Axios in React frontend

Open eakenbor opened this issue 3 years ago • 0 comments
trafficstars

Calling the url "//subscribe/" using axios from a React frontend does not work when the user is not authenticated. However, it works on Postman when using form-data instead of the request body.

Here is my code:

const formData = new FormData()
formData .append("email_field", "[email protected])
axios.post("/<general-newsletter/subscribe/", formData )

On sending, nothing happens in the backend instead of registering the email as an unactivated subscription.

Please can someone help me with this?

eakenbor avatar Nov 27 '21 19:11 eakenbor