mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
refactor(nuxt): simplify check in navigateTo
for server (#26546)
This commit is contained in:
parent
9b243631b4
commit
a33674b06b
@ -125,18 +125,16 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na
|
|||||||
const toPath = typeof to === 'string' ? to : (withQuery((to as RouteLocationPathRaw).path || '/', to.query || {}) + (to.hash || ''))
|
const toPath = typeof to === 'string' ? to : (withQuery((to as RouteLocationPathRaw).path || '/', to.query || {}) + (to.hash || ''))
|
||||||
|
|
||||||
// Early open handler
|
// Early open handler
|
||||||
if (options?.open) {
|
if (import.meta.client && options?.open) {
|
||||||
if (import.meta.client) {
|
const { target = '_blank', windowFeatures = {} } = options.open
|
||||||
const { target = '_blank', windowFeatures = {} } = options.open
|
|
||||||
|
|
||||||
const features = Object.entries(windowFeatures)
|
const features = Object.entries(windowFeatures)
|
||||||
.filter(([_, value]) => value !== undefined)
|
.filter(([_, value]) => value !== undefined)
|
||||||
.map(([feature, value]) => `${feature.toLowerCase()}=${value}`)
|
.map(([feature, value]) => `${feature.toLowerCase()}=${value}`)
|
||||||
.join(', ')
|
.join(', ')
|
||||||
|
|
||||||
open(toPath, target, features)
|
open(toPath, target, features)
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isExternal = options?.external || hasProtocol(toPath, { acceptRelative: true })
|
const isExternal = options?.external || hasProtocol(toPath, { acceptRelative: true })
|
||||||
|
Loading…
Reference in New Issue
Block a user