Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: switch try catch

httpjamesm93c317393f05
diff --git a/apps/cast/src/pages/slideshow.tsx b/apps/cast/src/pages/slideshow.tsx
index be65ab4311..32fca67355 100644
--- a/apps/cast/src/pages/slideshow.tsx
+++ b/apps/cast/src/pages/slideshow.tsx
@@ -26,18 +26,24 @@ export default function Slideshow() {
>({});
const init = async () => {
- // get requested collection id from localStorage
- const requestedCollectionID =
- window.localStorage.getItem('targetCollectionId');
+ try {
+ // get requested collection id from localStorage
+ const requestedCollectionID =
+ window.localStorage.getItem('targetCollectionId');
- const collection = await getCollection(Number(requestedCollectionID));
+ const collection = await getCollection(
+ Number(requestedCollectionID)
+ );
- const files = await syncFiles('normal', [collection], () => {});
+ const files = await syncFiles('normal', [collection], () => {});
- if (requestedCollectionID) {
- setCollectionFiles(
- files.filter((file) => isFileEligibleForCast(file))
- );
+ if (requestedCollectionID) {
+ setCollectionFiles(
+ files.filter((file) => isFileEligibleForCast(file))
+ );
+ }
+ } catch {
+ router.push('/');
}
};
@@ -70,11 +76,7 @@ export default function Slideshow() {
const router = useRouter();
useEffect(() => {
- try {
- init();
- } catch (e) {
- router.push('/');
- }
+ init();
}, []);
useEffect(() => {