Add backup listing
This commit is contained in:
24
dashboard/src/utils.js
Normal file
24
dashboard/src/utils.js
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
// https://stackoverflow.com/questions/3665115/how-to-create-a-file-in-memory-for-user-to-download-but-not-through-server#18197341
|
||||
function download(filename, text) {
|
||||
var element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
// named exports
|
||||
export {
|
||||
download,
|
||||
};
|
||||
|
||||
// default export
|
||||
export default {
|
||||
download,
|
||||
};
|
||||
Reference in New Issue
Block a user