From 5fd27250e285b5bb9a1240e8962a25b3ddf8d47c Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Fri, 21 Jun 2019 10:14:20 +0200 Subject: [PATCH] Fix #864: Redirect from / to /library when user is logged in --- changes/changelog.d/864.enhancement | 1 + front/src/components/Home.vue | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changes/changelog.d/864.enhancement diff --git a/changes/changelog.d/864.enhancement b/changes/changelog.d/864.enhancement new file mode 100644 index 000000000..f903ac850 --- /dev/null +++ b/changes/changelog.d/864.enhancement @@ -0,0 +1 @@ +Redirect from / to /library when user is logged in (#864) diff --git a/front/src/components/Home.vue b/front/src/components/Home.vue index 9393d9b78..bbcc9a8f9 100644 --- a/front/src/components/Home.vue +++ b/front/src/components/Home.vue @@ -147,7 +147,19 @@ export default { let msg = this.$pgettext('Content/Home/List item/Verb', 'Get quality metadata about your music thanks to MusicBrainz') return this.$gettextInterpolate(msg, {url: this.musicbrainzUrl}) } + }, + watch: { + '$store.state.auth.authenticated': { + handler (v) { + if (v) { + console.log('Authenticated, redirecting to /library…') + this.$router.push('/library') + } + }, + immediate: true + } } + }