fix: switch try catch
This commit is contained in:
parent
ff37b482ad
commit
93c317393f
|
@ -26,11 +26,14 @@ export default function Slideshow() {
|
|||
>({});
|
||||
|
||||
const init = async () => {
|
||||
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], () => {});
|
||||
|
||||
|
@ -39,6 +42,9 @@ export default function Slideshow() {
|
|||
files.filter((file) => isFileEligibleForCast(file))
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
router.push('/');
|
||||
}
|
||||
};
|
||||
|
||||
const isFileEligibleForCast = (file: EnteFile) => {
|
||||
|
@ -70,11 +76,7 @@ export default function Slideshow() {
|
|||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
init();
|
||||
} catch (e) {
|
||||
router.push('/');
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Reference in a new issue