mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-26 10:57:32 +00:00
11 lines
297 B
TypeScript
11 lines
297 B
TypeScript
import { getRequestURL } from 'h3'
|
|
import { useRequestEvent } from './ssr'
|
|
|
|
/** @since 3.5.0 */
|
|
export function useRequestURL (opts?: Parameters<typeof getRequestURL>[1]) {
|
|
if (import.meta.server) {
|
|
return getRequestURL(useRequestEvent()!, opts)
|
|
}
|
|
return new URL(window.location.href)
|
|
}
|