diff --git a/komga-webui/src/router.ts b/komga-webui/src/router.ts index de27db0d2..1797060a2 100644 --- a/komga-webui/src/router.ts +++ b/komga-webui/src/router.ts @@ -127,8 +127,9 @@ router.beforeEach((to, from, next) => { if (!['read-book', 'browse-book', 'browse-series'].includes(to.name)) { document.title = 'Komga' } - if (to.name !== 'startup' && to.name !== 'login' && !lStore.getters.authenticated) next({ name: 'startup' }) - else next() + if (to.name !== 'startup' && to.name !== 'login' && !lStore.getters.authenticated) { + next({ name: 'startup', query: { redirect: to.fullPath } }) + } else next() }) export default router diff --git a/komga-webui/src/views/Login.vue b/komga-webui/src/views/Login.vue index a8fca8cd2..4f795467d 100644 --- a/komga-webui/src/views/Login.vue +++ b/komga-webui/src/views/Login.vue @@ -93,7 +93,11 @@ export default Vue.extend({ await this.$store.dispatch('getLibraries') - this.$router.push({ name: 'home' }) + if (this.$route.query.redirect) { + this.$router.push({ path: this.$route.query.redirect.toString() }) + } else { + this.$router.push({ name: 'home' }) + } } catch (e) { this.showSnack(e.message) } diff --git a/komga-webui/src/views/Startup.vue b/komga-webui/src/views/Startup.vue index 5205f5212..f959b3286 100644 --- a/komga-webui/src/views/Startup.vue +++ b/komga-webui/src/views/Startup.vue @@ -19,7 +19,7 @@ export default Vue.extend({ await this.$store.dispatch('getLibraries') this.$router.back() } catch (e) { - this.$router.push({ name: 'login' }) + this.$router.push({ name: 'login', query: { redirect: this.$route.query.redirect } }) } }, })