Fix error when leaving Viewer

The carousel would go to a photo that doesn't exists
This commit is contained in:
2020-03-29 19:40:32 +02:00
parent 9a8d201f7e
commit 3b93e5e994

View File

@@ -121,7 +121,11 @@
// Viewer: Navigate to photo on init and URL change // Viewer: Navigate to photo on init and URL change
if (viewer) { if (viewer) {
page.subscribe(page => goToPhoto(photos.findIndex(photo => photo.slug === page.params.photo))) page.subscribe(page => {
if (page.path.includes('/viewer/')) {
goToPhoto(photos.findIndex(photo => photo.slug === page.params.photo))
}
})
} }
}) })
</script> </script>