import router from '@/router'
import { eNewRoleRelatedToBackEnd, eRole } from '@/types/role'

export default class RouterUtil {
  static instance: RouterUtil
  static getInstance() {
    if (!RouterUtil.instance) {
      RouterUtil.instance = new RouterUtil()
    }
    return RouterUtil.instance
  }

  gotoLogin(role: eNewRoleRelatedToBackEnd | undefined) {
    if (role === eNewRoleRelatedToBackEnd.PlatformAdmin) {
      router.push({
        name: 'adminLogin',
      })
    } else {
      router.push({
        name: 'login',
      })
    }
  }
}
