Add url to instantly download json export

pull/1/head
Made Baruna 2022-07-02 00:43:47 +07:00
parent 3aa8b6d7db
commit 6ef0c74622
2 changed files with 21 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<script>
import { mdiLoading } from '@mdi/js';
import { onMount } from 'svelte';
import { t } from 'svelte-i18n';
import Button from '../../components/Button.svelte';
@ -10,6 +11,7 @@
let input;
let files = null;
let loading = false;
export let immediate = false;
async function exportData() {
downloadData(await getLocalSaveJson(), 'paimon-moe-local-data');
@ -49,6 +51,10 @@
window.location.reload();
}, 5000);
}
onMount(() => {
if (immediate) exportData();
});
</script>
<div class="bg-background rounded-xl p-4 mb-4">

View File

@ -73,6 +73,21 @@
});
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() {