refactor: improve data handling in show and movie components

This commit is contained in:
maxid
2025-12-21 16:06:49 +01:00
parent 2493b43d4f
commit 9187617530
3 changed files with 24 additions and 25 deletions

View File

@@ -12,6 +12,7 @@
import client from '$lib/api';
import type { components } from '$lib/api/api';
import SelectFilePathSuffixDialog from '$lib/components/select-file-path-suffix-dialog.svelte';
import { invalidateAll } from '$app/navigation';
let { show }: { show: components['schemas']['Show'] } = $props();
let dialogueState = $state(false);
@@ -41,17 +42,15 @@
console.warn(errorMessage);
torrentsError = errorMessage;
if (dialogueState) toast.info(errorMessage);
return false;
} else if (!response.ok) {
const errorMessage = `Failed to download torrent for show ${show.id} and season ${selectedSeasonNumber}: ${response.statusText}`;
console.error(errorMessage);
torrentsError = errorMessage;
toast.error(errorMessage);
return false;
} else {
toast.success('Torrent download started successfully!');
return true;
}
await invalidateAll();
}
async function search() {