diff --git a/web/src/lib/components/add-media-card.svelte b/web/src/lib/components/add-media-card.svelte
index 3a679e8..4026669 100644
--- a/web/src/lib/components/add-media-card.svelte
+++ b/web/src/lib/components/add-media-card.svelte
@@ -2,7 +2,7 @@
import { Button } from '$lib/components/ui/button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import { ImageOff, LoaderCircle } from 'lucide-svelte';
- import { goto, invalidateAll } from '$app/navigation';
+ import { goto } from '$app/navigation';
import { resolve } from '$app/paths';
import type { components } from '$lib/api/api';
import client from '$lib/api';
@@ -40,11 +40,14 @@
}
if (isShow) {
- await goto(resolve('/dashboard/tv/[showId]', { showId: data?.id ?? '' }));
+ await goto(resolve('/dashboard/tv/[showId]', { showId: data?.id ?? '' }), {
+ invalidateAll: true
+ });
} else {
- await goto(resolve('/dashboard/movies/[movieId]', { movieId: data?.id ?? '' }));
+ await goto(resolve('/dashboard/movies/[movieId]', { movieId: data?.id ?? '' }), {
+ invalidateAll: true
+ });
}
- await invalidateAll();
loading = false;
}
diff --git a/web/src/lib/components/delete-media-dialog.svelte b/web/src/lib/components/delete-media-dialog.svelte
index 997c0bf..837d881 100644
--- a/web/src/lib/components/delete-media-dialog.svelte
+++ b/web/src/lib/components/delete-media-dialog.svelte
@@ -26,15 +26,14 @@
toast.error('Movie ID is missing');
return;
}
- const { response } = await client.DELETE('/api/v1/movies/{movie_id}', {
+ const { error } = await client.DELETE('/api/v1/movies/{movie_id}', {
params: {
path: { movie_id: media.id },
query: { delete_files_on_disk: deleteFilesOnDisk, delete_torrents: deleteTorrents }
}
});
- if (!response.ok) {
- const errorText = await response.text();
- toast.error('Failed to delete movie: ' + errorText);
+ if (error) {
+ toast.error('Failed to delete movie: ' + error.detail);
} else {
toast.success('Movie deleted successfully.');
deleteDialogOpen = false;
@@ -43,15 +42,14 @@
}
async function delete_show() {
- const { response } = await client.DELETE('/api/v1/tv/shows/{show_id}', {
+ const { error } = await client.DELETE('/api/v1/tv/shows/{show_id}', {
params: {
path: { show_id: media.id! },
query: { delete_files_on_disk: deleteFilesOnDisk, delete_torrents: deleteTorrents }
}
});
- if (!response.ok) {
- const errorText = await response.text();
- toast.error('Failed to delete show: ' + errorText);
+ if (error) {
+ toast.error('Failed to delete show: ' + error.detail);
} else {
toast.success('Show deleted successfully.');
deleteDialogOpen = false;
diff --git a/web/src/lib/components/edit-torrent-dialog.svelte b/web/src/lib/components/edit-torrent-dialog.svelte
index 27cd318..0582c3a 100644
--- a/web/src/lib/components/edit-torrent-dialog.svelte
+++ b/web/src/lib/components/edit-torrent-dialog.svelte
@@ -14,11 +14,10 @@
torrent: components['schemas']['MovieTorrent'] | components['schemas']['RichSeasonTorrent'];
} = $props();
let dialogOpen = $state(false);
- let importedState = $state(torrent.imported || false);
+ let importedState = $derived(torrent.imported);
async function closeDialog() {
dialogOpen = false;
- importedState = torrent.imported || false;
}
async function saveTorrent() {
const { error } = await client.PATCH('/api/v1/torrent/{torrent_id}/status', {
@@ -32,8 +31,7 @@
}
});
if (error) {
- console.error(`Failed to update torrent ${torrent.torrent_id} imported state: ${error}`);
- toast.error(`Failed to update torrent: ${error}`);
+ toast.error('Failed to update torrent.');
return;
}
await invalidateAll();
@@ -53,10 +51,8 @@
+
-
diff --git a/web/src/lib/components/library-combobox.svelte b/web/src/lib/components/library-combobox.svelte
index fb6c840..a5b5ac0 100644
--- a/web/src/lib/components/library-combobox.svelte
+++ b/web/src/lib/components/library-combobox.svelte
@@ -9,6 +9,7 @@
import { toast } from 'svelte-sonner';
import client from '$lib/api';
import type { components } from '$lib/api/api';
+ import { invalidateAll } from '$app/navigation';
let {
media,
@@ -70,6 +71,7 @@
toast.success(`Library updated to ${selectedLabel}`);
media.library = selectedLabel;
}
+ await invalidateAll();
}
function closeAndFocusTrigger() {
diff --git a/web/src/lib/components/request-movie-dialog.svelte b/web/src/lib/components/request-movie-dialog.svelte
index 0d27661..d846227 100644
--- a/web/src/lib/components/request-movie-dialog.svelte
+++ b/web/src/lib/components/request-movie-dialog.svelte
@@ -8,6 +8,7 @@
import { toast } from 'svelte-sonner';
import client from '$lib/api';
import type { components } from '$lib/api/api';
+ import { invalidateAll } from '$app/navigation';
let { movie }: { movie: components['schemas']['PublicMovie'] } = $props();
let dialogOpen = $state(false);
@@ -44,6 +45,7 @@
} else {
toast.error('Failed to submit request');
}
+ await invalidateAll();
}
diff --git a/web/src/lib/components/season-requests-table.svelte b/web/src/lib/components/season-requests-table.svelte
index bb3efde..10d1a10 100644
--- a/web/src/lib/components/season-requests-table.svelte
+++ b/web/src/lib/components/season-requests-table.svelte
@@ -7,7 +7,7 @@
import { getContext } from 'svelte';
import { Button } from '$lib/components/ui/button/index.js';
import { toast } from 'svelte-sonner';
- import { goto } from '$app/navigation';
+ import { goto, invalidateAll } from '$app/navigation';
import { resolve } from '$app/paths';
import client from '$lib/api';
@@ -56,12 +56,6 @@
response = data.response;
}
if (response.ok) {
- const requestIndex = requests.findIndex((r) => r.id === requestId);
- if (requestIndex !== -1) {
- let newAuthorizedStatus = !currentAuthorizedStatus;
- requests[requestIndex]!.authorized = newAuthorizedStatus;
- requests[requestIndex]!.authorized_by = newAuthorizedStatus ? user() : undefined;
- }
toast.success(
`Request ${!currentAuthorizedStatus ? 'approved' : 'unapproved'} successfully.`
);
@@ -70,6 +64,7 @@
console.error(`Failed to update request status ${response.statusText}`, errorText);
toast.error(`Failed to update request status: ${response.statusText}`);
}
+ await invalidateAll();
}
async function deleteRequest(requestId: string) {
@@ -101,16 +96,12 @@
response = data.response;
}
if (response.ok) {
- // remove the request from the list
- const index = requests.findIndex((r) => r.id === requestId);
- if (index > -1) {
- requests.splice(index, 1);
- }
toast.success('Request deleted successfully');
} else {
console.error(`Failed to delete request ${response.statusText}`, await response.text());
toast.error('Failed to delete request');
}
+ await invalidateAll();
}
diff --git a/web/src/lib/components/torrent-table.svelte b/web/src/lib/components/torrent-table.svelte
index b45f10a..4ac61ec 100644
--- a/web/src/lib/components/torrent-table.svelte
+++ b/web/src/lib/components/torrent-table.svelte
@@ -13,6 +13,7 @@
import { toast } from 'svelte-sonner';
import DeleteTorrentDialog from '$lib/components/delete-torrent-dialog.svelte';
import EditTorrentDialog from '$lib/components/edit-torrent-dialog.svelte';
+ import { invalidateAll } from '$app/navigation';
let {
torrents,
isShow = true
@@ -42,6 +43,7 @@
console.log(`Successfully retried download for torrent ${torrent.torrent_title}`);
toast.success('Trying to download torrent...');
}
+ await invalidateAll();
}
diff --git a/web/src/lib/components/user-data-table.svelte b/web/src/lib/components/user-data-table.svelte
index 4bdcc11..ef0a7ac 100644
--- a/web/src/lib/components/user-data-table.svelte
+++ b/web/src/lib/components/user-data-table.svelte
@@ -47,8 +47,8 @@
selectedUser = null;
newPassword = '';
newEmail = '';
- await invalidateAll();
}
+ await invalidateAll();
}
async function deleteUser() {
@@ -68,8 +68,8 @@
toast.success(`User ${userToDelete.email} deleted successfully.`);
deleteDialogOpen = false;
userToDelete = null;
- await invalidateAll();
}
+ await invalidateAll();
}
diff --git a/web/src/lib/components/user-settings.svelte b/web/src/lib/components/user-settings.svelte
index 12450cd..bd93e8e 100644
--- a/web/src/lib/components/user-settings.svelte
+++ b/web/src/lib/components/user-settings.svelte
@@ -5,6 +5,7 @@
import { Label } from '$lib/components/ui/label/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import client from '$lib/api';
+ import { invalidateAll } from '$app/navigation';
let newPassword: string = $state('');
let newEmail: string = $state('');
@@ -25,6 +26,7 @@
}
newPassword = '';
newEmail = '';
+ await invalidateAll();
}