feat: enhance user feedback with toast notifications for various actions and errors

This commit is contained in:
maxDorninger
2025-05-24 20:58:54 +02:00
parent 6513065ba8
commit 0ea500bacd
7 changed files with 64 additions and 26 deletions

View File

@@ -41,8 +41,8 @@ export function getFullyQualifiedShowName(show: { name: string; year: number }):
}
export function convertTorrentSeasonRangeToIntegerRange(torrent: any): string {
if (torrent.seasons.length === 1) return torrent.seasons[0]?.toString();
if (torrent.seasons.length >= 2) return torrent.seasons[0]?.toString() + "-" + torrent.seasons.at(-1).toString();
if (torrent.season?.length === 1) return torrent.season[0]?.toString();
if (torrent.season?.length >= 2) return torrent.season[0]?.toString() + "-" + torrent.season.at(-1).toString();
else {
console.log("Error parsing season range: " + torrent.seasons);
return "Error parsing season range: " + torrent.seasons;
@@ -50,7 +50,7 @@ export function convertTorrentSeasonRangeToIntegerRange(torrent: any): string {
}
export async function handleLogout(): null {
export async function handleLogout() {
const response = await fetch(apiUrl + '/auth/cookie/logout', {
method: 'POST',
credentials: 'include'
@@ -63,5 +63,4 @@ export async function handleLogout(): null {
console.error('Logout failed:', response.status);
toast.error('Logout failed: ' + response.status);
}
}
}