From b14d6c7a535aff3dcd6f1940d1bec5e022ea61d2 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期四, 09 十二月 2021 18:03:07 +0800 Subject: [PATCH] update: 1. 顧問未登入進入預約清單, 會導回顧問登入頁 2. 輸入網址為/myAppointmentList會直接導頁到/myAppointmentList/appointmentList --- PAMapp/pages/myAppointmentList.vue | 3 ++- PAMapp/middleware/myAppointmentMiddleware.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/PAMapp/middleware/myAppointmentMiddleware.ts b/PAMapp/middleware/myAppointmentMiddleware.ts new file mode 100644 index 0000000..eab3b12 --- /dev/null +++ b/PAMapp/middleware/myAppointmentMiddleware.ts @@ -0,0 +1,14 @@ +import { Middleware } from '@nuxt/types'; +import { Role } from '~/assets/ts/models/enum/Role'; + +const myAppointmentMiddleware: Middleware = (context) => { + if (context.store.getters['localStorage/currentRole'] === Role.ADMIN) { + if (context.route.name === 'myAppointmentList') { + context.redirect('/myAppointmentList/appointmentList') + } + } else { + context.redirect('/consultantLogin'); + } +} + +export default myAppointmentMiddleware \ No newline at end of file diff --git a/PAMapp/pages/myAppointmentList.vue b/PAMapp/pages/myAppointmentList.vue index 85a57da..103b62a 100644 --- a/PAMapp/pages/myAppointmentList.vue +++ b/PAMapp/pages/myAppointmentList.vue @@ -44,7 +44,8 @@ import * as _ from 'lodash'; @Component({ - layout: 'home' + layout: 'home', + middleware: 'myAppointmentMiddleware' }) export default class ClientReservedList extends Vue { activeTabName = 'appointmentList'; -- Gitblit v1.8.0