mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
feat(nuxt): support passing options to useRequestURL
(#26687)
This commit is contained in:
parent
5695027a03
commit
0a1b72f9fd
@ -2,9 +2,9 @@ import { getRequestURL } from 'h3'
|
|||||||
import { useRequestEvent } from './ssr'
|
import { useRequestEvent } from './ssr'
|
||||||
|
|
||||||
/** @since 3.5.0 */
|
/** @since 3.5.0 */
|
||||||
export function useRequestURL () {
|
export function useRequestURL (opts?: Parameters<typeof getRequestURL>[1]) {
|
||||||
if (import.meta.server) {
|
if (import.meta.server) {
|
||||||
return getRequestURL(useRequestEvent()!)
|
return getRequestURL(useRequestEvent()!, opts)
|
||||||
}
|
}
|
||||||
return new URL(window.location.href)
|
return new URL(window.location.href)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user