Add url to instantly download json export
parent
3aa8b6d7db
commit
6ef0c74622
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { mdiLoading } from '@mdi/js';
|
import { mdiLoading } from '@mdi/js';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import Button from '../../components/Button.svelte';
|
import Button from '../../components/Button.svelte';
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
let input;
|
let input;
|
||||||
let files = null;
|
let files = null;
|
||||||
let loading = false;
|
let loading = false;
|
||||||
|
export let immediate = false;
|
||||||
|
|
||||||
async function exportData() {
|
async function exportData() {
|
||||||
downloadData(await getLocalSaveJson(), 'paimon-moe-local-data');
|
downloadData(await getLocalSaveJson(), 'paimon-moe-local-data');
|
||||||
|
@ -49,6 +51,10 @@
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (immediate) exportData();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="bg-background rounded-xl p-4 mb-4">
|
<div class="bg-background rounded-xl p-4 mb-4">
|
||||||
|
|
|
@ -73,6 +73,21 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
mounted = true;
|
mounted = true;
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const download = urlParams.get('download');
|
||||||
|
if (download === 'json') {
|
||||||
|
openModal(
|
||||||
|
ExportImportModal,
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
closeButton: false,
|
||||||
|
styleWindow: { background: '#25294A', width: '500px' },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateServer() {
|
function updateServer() {
|
||||||
|
|
Loading…
Reference in New Issue