mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-04-13 20:41:56 +01:00
fix
This commit is contained in:
@@ -85,6 +85,16 @@ export default function index() {
|
||||
staleTime: 60,
|
||||
});
|
||||
|
||||
if (isError)
|
||||
return (
|
||||
<View className="flex flex-col items-center justify-center h-full -mt-12">
|
||||
<Text className="text-3xl font-bold mb-2">Oops!</Text>
|
||||
<Text className="text-center opacity-70">
|
||||
Something went wrong.{"\n"}Please log out and in again.
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
if (isLoading)
|
||||
return (
|
||||
<View className="justify-center items-center h-full">
|
||||
@@ -92,8 +102,6 @@ export default function index() {
|
||||
</View>
|
||||
);
|
||||
|
||||
if (isError) return <Text>Error loading items</Text>;
|
||||
|
||||
if (!data || data.length === 0) return <Text>No data...</Text>;
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Button } from "@/components/Button";
|
||||
import { Text } from "@/components/common/Text";
|
||||
import { runningProcesses } from "@/components/DownloadItem";
|
||||
import { ListItem } from "@/components/ListItem";
|
||||
import ProgressCircle from "@/components/ProgressCircle";
|
||||
import { apiAtom, useJellyfin, userAtom } from "@/providers/JellyfinProvider";
|
||||
import { runningProcesses } from "@/utils/atoms/downloads";
|
||||
import { readFromLog } from "@/utils/log";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
@@ -38,14 +38,11 @@ const deleteFile = async (id: string | null | undefined) => {
|
||||
(err) => console.error(err)
|
||||
);
|
||||
|
||||
AsyncStorage.setItem(
|
||||
"downloaded_files",
|
||||
JSON.stringify([
|
||||
JSON.parse(
|
||||
(await AsyncStorage.getItem("downloaded_files")) || "[]"
|
||||
).filter((f: string) => f !== id),
|
||||
])
|
||||
const currentFiles = JSON.parse(
|
||||
(await AsyncStorage.getItem("downloaded_files")) ?? "[]"
|
||||
);
|
||||
const updatedFiles = currentFiles.filter((f: string) => f !== id);
|
||||
await AsyncStorage.setItem("downloaded_files", JSON.stringify(updatedFiles));
|
||||
};
|
||||
|
||||
const listDownloadedFiles = async () => {
|
||||
@@ -81,6 +78,11 @@ export default function settings() {
|
||||
(await AsyncStorage.getItem("downloaded_files")) || "[]"
|
||||
) as BaseItemDto[];
|
||||
|
||||
console.log(
|
||||
"Files",
|
||||
data.map((i) => i.Name)
|
||||
);
|
||||
|
||||
setFiles(data);
|
||||
})();
|
||||
}, [key]);
|
||||
@@ -160,8 +162,8 @@ export default function settings() {
|
||||
<Button
|
||||
className="mb-2"
|
||||
color="red"
|
||||
onPress={() => {
|
||||
deleteAllFiles();
|
||||
onPress={async () => {
|
||||
await deleteAllFiles();
|
||||
setKey((prevKey) => prevKey + 1);
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user