feat(nuxt): support passing options to `useRequestURL` (#26687)

This commit is contained in:
Damian Głowala 2024-04-09 15:03:29 +02:00 committed by GitHub
parent 5695027a03
commit 0a1b72f9fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -2,9 +2,9 @@ import { getRequestURL } from 'h3'
import { useRequestEvent } from './ssr'
/** @since 3.5.0 */
export function useRequestURL () {
export function useRequestURL (opts?: Parameters<typeof getRequestURL>[1]) {
if (import.meta.server) {
return getRequestURL(useRequestEvent()!)
return getRequestURL(useRequestEvent()!, opts)
}
return new URL(window.location.href)
}