I am using React-Dropzone-Uploader for uploading the images to my API.
The API takes Request Body:
{
image: “file”
}
and gives Success Response Data:
{
success: true, message: “success” // all user, plan info data
}
I am not able to do that.
I am using axios for API calls.
''let image=files API.post('/web/v1.0/upload',{image}).then(response=>{ console.log(response.data) })''
You are facing this issue because your request is not authenticated 401 is nothing to do with axios check the API and if it is required authentication send your auth_token
like this:
headers : {
'Content-Type' : 'application/json',
'Accept' : 'application/json',
'Authorization' : 'Bearer <token_here>'
}