From 203f5c62f086244d69d3f76c464585d3ff49aab6 Mon Sep 17 00:00:00 2001 From: hoon7566 Date: Tue, 15 Mar 2022 18:36:12 +0900 Subject: [PATCH] =?UTF-8?q?fix(customer-vue):=20login=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - login 페이지 수정 --- customer-vue/src/router/router.js | 12 +- customer-vue/src/views/LoginPage.vue | 176 +++++++++++++++------------ 2 files changed, 105 insertions(+), 83 deletions(-) diff --git a/customer-vue/src/router/router.js b/customer-vue/src/router/router.js index a3afd88..4b85163 100644 --- a/customer-vue/src/router/router.js +++ b/customer-vue/src/router/router.js @@ -23,7 +23,7 @@ const authCheck = async function (to, from, next) { await auth.requestCheckAccessToken(); } } catch (error) { - await router.replace("/login"); + await router.push("/login"); } next(); }; @@ -60,11 +60,6 @@ const routes = [ name: 'notification', component: () => import('../views/NotificationView') }, - { - path: '/login', - name: 'login', - component: () => import('../views/LoginPage') - }, { path: "/item/:itemId", name: 'itemDetail', @@ -77,6 +72,11 @@ const routes = [ }, ] }, + { + path: '/login', + component: () => import('../views/LoginPage'), + }, + { path: '/store', redirect: 'store', diff --git a/customer-vue/src/views/LoginPage.vue b/customer-vue/src/views/LoginPage.vue index 38add22..9f46eb6 100644 --- a/customer-vue/src/views/LoginPage.vue +++ b/customer-vue/src/views/LoginPage.vue @@ -1,77 +1,84 @@ @@ -79,29 +86,31 @@ import logo from '@/assets/justLogo.png' import logo_naver from '@/assets/logo_naver.svg' import logo_google from '@/assets/logo_google.png' +import jwt from "@/common/jwt"; +import router from "@/router/router"; export default { name: "LoginPage", - data (){ + data() { return { - logo : logo, + logo: logo, logo_naver: logo_naver, - logo_google : logo_google, + logo_google: logo_google, auth_popup: null, } }, watch: { - auth_popup : function () { - this.auth_popup.addEventListener('beforeunload', function() { - window.location.href=process.env.VUE_APP_BASEURL; + auth_popup: function () { + this.auth_popup.addEventListener('beforeunload', function () { + window.location.href = process.env.VUE_APP_BASEURL; }); } }, methods: { - login_auth: async function(target) { - const _url = process.env.VUE_APP_CUSTOMER_SERVICE_BASEURL+'/user-service/oauth2/authorization/'+target + login_auth: async function (target) { + const _url = process.env.VUE_APP_CUSTOMER_SERVICE_BASEURL + '/user-service/oauth2/authorization/' + target this.auth_popup = window.open( _url, "", @@ -110,9 +119,22 @@ export default { }, }, + async mounted() { + + if (!jwt.isExpired()) + await router.push("/"); + + } } \ No newline at end of file