JavaScript Fetch Post Form Данные
javascript fetch post form data with headers , in reactjs
--------------------------------
let formData = new FormData();
formData.append('data', 'formdata');
formData.append('data', 'formdata');
export const getData = async () => {
await fetch('----url------', {
method: 'POST',
headers: {
Authorization: 'Basic -------token----------',
},
body: formData
}).then(response => response.json())
.then(data => {
console.log(data);
})
}
ASHABB