From bef3564ce3771be99e37b72da4946cc535b801c5 Mon Sep 17 00:00:00 2001 From: mservidio Date: Thu, 15 Apr 2021 16:24:35 -0400 Subject: [PATCH] Marketplace activation failing for non logged in user (#484) * Update router.js * Update ActivationCard.vue * Update ActivationCard.vue * Update main.js * Update ActivationCard.vue * Revert "Update main.js" This reverts commit 6ed46ca48b3513bb568611d9f682c704f75d8779. * Update ActivationCard.vue * Update ActivationCard.vue * Update ActivationCard.vue * Update ActivationCard.vue * Update ActivationCard.vue --- frontend/src/components/ActivationCard.vue | 15 +++++++++++---- frontend/src/router.js | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/ActivationCard.vue b/frontend/src/components/ActivationCard.vue index 820fb4f7c..f27f36aeb 100644 --- a/frontend/src/components/ActivationCard.vue +++ b/frontend/src/components/ActivationCard.vue @@ -18,7 +18,8 @@ export default { }, data: () => ({ user: null, - activated: false + activated: false, + jwtToken: null }), methods: { getCookie(name) { @@ -58,12 +59,18 @@ export default { }
Email: ${this.user ? this.user.email : ''}
Activation Status: ${this.activated}`; - }, - jwtToken() { - return this.getCookie('gmt') || this.$route.query.gmt; } }, mounted() { + const token = this.getCookie('gmt') || this.$route.query.gmt; + if (token) { + this.jwtToken = token; + localStorage.setItem('gmt', token); + } else { + this.jwtToken = localStorage.getItem('gmt'); + localStorage.removeItem('gmt'); + } + this.performLogin().then(result => { if (result) { this.user = { diff --git a/frontend/src/router.js b/frontend/src/router.js index 07238c29f..79b3fa3dc 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -149,7 +149,7 @@ router.beforeEach((to, from, next) => { if (store.getters.isLoggedIn) { next(); return; - } else if (to.name === 'myProducts') { + } else if (to.name === 'myProducts' || to.name === 'activation') { next(); return; } else {