import { inject } from 'vue' /** * @typedef {{ * a: 1 * }} PageData * * @typedef {import('vue').Ref} PageDataRef */ /** * @type {import('vue').InjectionKey} */ export const pageDataSymbol = Symbol() /** * @returns {PageDataRef} */ export function usePageData() { const data = inject(pageDataSymbol) if (!data) { throw new Error('usePageData() is called without provider.') } return data }