mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-14 19:25:50 +00:00
add file-saver as backup
This commit is contained in:
parent
c14d7a0f60
commit
2a4866a679
@ -11,7 +11,7 @@ import {
|
|||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
||||||
});
|
});
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
import * as actions from '../../components/qdn-action-types';
|
import * as actions from '../../components/qdn-action-types';
|
||||||
import '@material/mwc-button';
|
import '@material/mwc-button';
|
||||||
import '@material/mwc-icon';
|
import '@material/mwc-icon';
|
||||||
@ -1454,23 +1454,29 @@ class WebBrowser extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const fileHandle = await self.showSaveFilePicker({
|
|
||||||
suggestedName: filename,
|
try {
|
||||||
types: [
|
const fileHandle = await self.showSaveFilePicker({
|
||||||
{
|
suggestedName: filename,
|
||||||
description: mimeType,
|
types: [
|
||||||
...fileHandleOptions
|
{
|
||||||
},
|
description: mimeType,
|
||||||
]
|
...fileHandleOptions
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
const writeFile = async (fileHandle, contents) => {
|
const writeFile = async (fileHandle, contents) => {
|
||||||
const writable = await fileHandle.createWritable()
|
const writable = await fileHandle.createWritable()
|
||||||
await writable.write(contents)
|
await writable.write(contents)
|
||||||
await writable.close()
|
await writable.close()
|
||||||
|
}
|
||||||
|
writeFile(fileHandle, blob).then(() => console.log("FILE SAVED"))
|
||||||
|
} catch (error) {
|
||||||
|
FileSaver.saveAs(blob, filename)
|
||||||
}
|
}
|
||||||
writeFile(fileHandle, blob).then(() => console.log("FILE SAVED"))
|
|
||||||
response = JSON.stringify(true);
|
response = JSON.stringify(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const obj = {};
|
const obj = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user