Clear progress on delete
This commit is contained in:
@@ -3,9 +3,15 @@
|
||||
import { db } from '$lib/catalog/db';
|
||||
import { promptConfirmation } from '$lib/util';
|
||||
import { goto } from '$app/navigation';
|
||||
import { clearVolumes } from '$lib/settings';
|
||||
|
||||
function onConfirm() {
|
||||
clearVolumes();
|
||||
db.catalog.clear();
|
||||
}
|
||||
|
||||
function onClear() {
|
||||
promptConfirmation('Are you sure you want to clear your catalog?', () => db.catalog.clear());
|
||||
promptConfirmation('Are you sure you want to clear your catalog?', onConfirm);
|
||||
goto('/');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -44,6 +44,17 @@ export function initializeVolume(volume: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteVolume(volume: string) {
|
||||
volumes.update((prev) => {
|
||||
delete prev[volume]
|
||||
return prev
|
||||
})
|
||||
}
|
||||
|
||||
export function clearVolumes() {
|
||||
volumes.set({});
|
||||
}
|
||||
|
||||
export function updateProgress(volume: string, progress: number, chars: number, completed = false) {
|
||||
volumes.update((prev) => {
|
||||
return {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { promptConfirmation } from '$lib/util';
|
||||
import { page } from '$app/stores';
|
||||
import type { Volume } from '$lib/types';
|
||||
import { onMount } from 'svelte';
|
||||
import { deleteVolume } from '$lib/settings';
|
||||
|
||||
function sortManga(a: Volume, b: Volume) {
|
||||
if (a.volumeName < b.volumeName) {
|
||||
@@ -23,6 +23,11 @@
|
||||
|
||||
async function confirmDelete() {
|
||||
const title = manga?.[0].mokuroData.title_uuid;
|
||||
manga?.forEach((vol) => {
|
||||
const volId = vol.mokuroData.volume_uuid;
|
||||
deleteVolume(volId);
|
||||
});
|
||||
|
||||
await db.catalog.delete(title);
|
||||
goto('/');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user