(defaultConfig)
| 25 | }; |
| 26 | |
| 27 | export function useRoute(defaultConfig) { |
| 28 | if ( |
| 29 | !defaultConfig && |
| 30 | !globalThis.Ziggy && |
| 31 | typeof Ziggy === 'undefined' && |
| 32 | !document.getElementById('ziggy-routes-json') |
| 33 | ) { |
| 34 | throw new Error( |
| 35 | 'Ziggy error: missing configuration. Ensure that a `Ziggy` variable is defined globally or pass a config object into the useRoute hook.', |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | return (name, params, absolute, config = defaultConfig) => |
| 40 | route(name, params, absolute, config); |
| 41 | } |