// hooks/useRoute.ts
import { reactive } from 'vue'

const routeState = reactive({
  path: '',
  query: {} as Record<string, any>
})

export function updateRoute() {
  const pages = getCurrentPages()
  const current = pages[pages.length - 1]

  if (current) {
    routeState.path = '/' + (current.route || '')
    routeState.query = { ...(current.options || {}) }
  }
}

export default function useRoute() {
  return routeState
}
