保誠-保戶業務員媒合平台
Tomas
2022-03-01 201a97a7379561b24c0699aa6f094711059b7ac5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { Middleware } from '@nuxt/types';
 
const myAppointment: Middleware = (context) => {
  const appointmentIdFromMsg = context.route.query.appointmentId;
  if (appointmentIdFromMsg) {
    context.store.commit('localStorage/storageAppointmentIdFromMsg', appointmentIdFromMsg);
  };
 
  const isAdminLogin = context.store.getters['localStorage/isAdminLogin'];
  if (isAdminLogin) {
    if (context.route.name === 'myAppointmentList') {
      context.redirect('/myAppointmentList/appointmentList')
    }
  } else {
    context.redirect('/consultantLogin');
  }
}
 
export default myAppointment