muffin-admin 3.14.1 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dataprovider.js +5 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/dataprovider.ts +4 -1
package/dist/dataprovider.js
CHANGED
|
@@ -102,6 +102,7 @@ export function MuffinDataprovider(apiUrl) {
|
|
|
102
102
|
return { data: json };
|
|
103
103
|
}),
|
|
104
104
|
downloadFile: (path) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
var _a;
|
|
105
106
|
path = path.replace(/^\/+/, "");
|
|
106
107
|
const response = yield fetch(`${apiUrl}/${path}`, {
|
|
107
108
|
headers: requestHeaders,
|
|
@@ -109,7 +110,10 @@ export function MuffinDataprovider(apiUrl) {
|
|
|
109
110
|
const url = window.URL.createObjectURL(yield response.blob());
|
|
110
111
|
const link = document.createElement("a");
|
|
111
112
|
link.href = url;
|
|
112
|
-
|
|
113
|
+
const filename = ((_a = response.headers.get("content-disposition")) === null || _a === void 0 ? void 0 : _a.split("filename=")[1]) || path.split("/").pop();
|
|
114
|
+
link.setAttribute("download", filename);
|
|
115
|
+
if (filename)
|
|
116
|
+
link.setAttribute("download", filename);
|
|
113
117
|
link.click();
|
|
114
118
|
// no need to append link as child to body.
|
|
115
119
|
setTimeout(() => window.URL.revokeObjectURL(url), 0); // this is important too, otherwise we will be unnecessarily spiking memory!
|