From 4e39df490af5a4dc599db68df1c9ec5ac89cebb3 Mon Sep 17 00:00:00 2001 From: Andrew Robonen Date: Tue, 7 Jun 2022 15:06:57 +0700 Subject: [PATCH] User authentication fix --- README.md | 3 --- frontend/src/views/CatalogView.vue | 6 +++++- frontend/src/views/OfferView.vue | 5 +++++ frontend/src/views/ProfileView.vue | 6 ++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4d46ad6..878d39b 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,6 @@ - - - diff --git a/frontend/src/views/CatalogView.vue b/frontend/src/views/CatalogView.vue index 6985ac3..5745534 100644 --- a/frontend/src/views/CatalogView.vue +++ b/frontend/src/views/CatalogView.vue @@ -144,13 +144,17 @@ export default { } }, async mounted() { + if (this.$store.getters.userAuthenticated) { + this.$router.push('/profile'); + return; + } await this.addSearchParam(this.$route.query); }, watch: { '$route.query'(value) { this.addSearchParam(value); } - } + }, } diff --git a/frontend/src/views/OfferView.vue b/frontend/src/views/OfferView.vue index 1dabe90..186a2ab 100644 --- a/frontend/src/views/OfferView.vue +++ b/frontend/src/views/OfferView.vue @@ -150,6 +150,11 @@ export default { } }, async mounted() { + if (this.$store.getters.userAuthenticated) { + this.$router.push('/profile'); + return; + } + const id = this.$route.params.id; if (id === undefined) diff --git a/frontend/src/views/ProfileView.vue b/frontend/src/views/ProfileView.vue index 4f8d1d9..f1fd45e 100644 --- a/frontend/src/views/ProfileView.vue +++ b/frontend/src/views/ProfileView.vue @@ -81,6 +81,12 @@ export default { }); } }, + mounted() { + if (this.$store.getters.userAuthenticated) { + this.$router.push('/profile'); + return; + } + } } >