I get this error: Failed to execute 'blob' on 'Response': body stream already read. when trying to get the blob.
Code reactjs:
export const createCSVPostPrivateAction = async (model, dispatch) => {
return Post(API_CREATE_CSV_POST_PRIVATE, null, model, null, null)
.then(res => {
if (res.ok) {
const file = res.blob();
saveAs(file, "report.xlsx");
Post function:
fetch(API, {
method: 'POST',
headers: Header('application/json', header),
body: JSON.stringify(model),
})
.then(res => {
if (convertToJson) {
if (res.ok) return res.json();
} else {
return res;
}
})
Code C#:
return File(content, "application/vnd.openxmlformats-
officedocument.spreadsheetml.sheet", "baocao.xlsx");
Can someone help me? I am desperate with this !!!!