fix(ui): keep trash counter in sync with trash changes
Reload the rail trash count after every operation that changes the trash contents, not just navigation and empty-trash: moving photos to trash (grid, panel, viewer), restoring, permanent delete and deleting an album. Previously the counter stayed stale until the next route change.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { api } from '$lib/api';
|
||||
import Icon from '$lib/components/Icon.svelte';
|
||||
import { trash } from '$lib/stores/trash.svelte';
|
||||
import type { Album, ShareLink } from '$lib/types';
|
||||
|
||||
const albumId = $derived($page.params.id);
|
||||
@@ -73,6 +74,7 @@
|
||||
if (!confirm('Удалить альбом вместе с фото?')) return;
|
||||
try {
|
||||
await api(`/albums/${albumId}`, { method: 'DELETE' });
|
||||
await trash.load();
|
||||
goto('/');
|
||||
} catch (e) {
|
||||
error = (e as Error).message;
|
||||
|
||||
Reference in New Issue
Block a user