feat: go back to downloads tab if all episodes removed

This commit is contained in:
Adrian Castro
2024-04-15 03:04:32 +02:00
parent 097296fcfa
commit 0622e4338c

View File

@@ -1,4 +1,4 @@
import { useMemo } from "react"; import { useEffect, useMemo } from "react";
import { Stack, useLocalSearchParams, useRouter } from "expo-router"; import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import { YStack } from "tamagui"; import { YStack } from "tamagui";
@@ -21,6 +21,10 @@ export default function Page() {
return allDownloads.find((download) => download.media.tmdbId === tmdbId); return allDownloads.find((download) => download.media.tmdbId === tmdbId);
}, [allDownloads, tmdbId]); }, [allDownloads, tmdbId]);
useEffect(() => {
if (!download) router.back();
}, [download, router]);
const handlePress = (localPath?: string) => { const handlePress = (localPath?: string) => {
if (!localPath) return; if (!localPath) return;
resetVideo(); resetVideo();