Added support to download QR codes to the QR code modal

This commit is contained in:
Alejandro Celaya
2021-08-16 13:12:07 +02:00
parent 2b5420a429
commit eb90aa2274
8 changed files with 64 additions and 14 deletions

View File

@@ -1,7 +1,5 @@
export const saveCsv = ({ document }: Window, csv: string, filename: string) => {
export const saveUrl = ({ document }: Window, url: string, filename: string) => {
const link = document.createElement('a');
const blob = new Blob([ csv ], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', filename);
@@ -10,3 +8,10 @@ export const saveCsv = ({ document }: Window, csv: string, filename: string) =>
link.click();
document.body.removeChild(link);
};
export const saveCsv = (window: Window, csv: string, filename: string) => {
const blob = new Blob([ csv ], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
saveUrl(window, url, filename);
};