Z frontu strzelam sobie do endpointa, który zwraca mi plik excel. Przez przeglądarkę i swaggera wszystko działa tak jak należy. Na froncie mam problem chyba ze względu na zły content type.
private async downloadDocumentTemplate(report: string) {
this.fileLoading = true;
try {
const result = await this.$store.dispatch("report/downloadDocument", report);
console.log("contentType" + result.contentType)
console.log("result" + result )
const blob = new Blob([Utils.base64ToArrayBuffer(result.content)], {type: 'application/octet-stream'});
FileSaver.saveAs(blob, result.name);
} catch (ex) {
this.$store.commit('app/showErrorPopup', ex);
}
this.fileLoading = false;
}
Błąd w załączniku:
próbowałem też z :
application/excel
application/vnd.ms-excel
application/x-excel
application/x-msexcel