Post form data to api endpoint
You need to build your request body using the FormData API.
The FormData interface provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to “multipart/form-data”.
https://stackoverflow.com/questions/49222008/react-how-to-post-form-data-to-an-api-endpoint
However i’m stuck trying to take the form data from the component, store it as an object
called request_data
which I will then pass to submit_task()
on the buttons onClick
.
How do you go about this?
RESPONSE
In your form
Now in your class
and in your constructor