fix: static extension public page wrong redirect (#3639)

This commit is contained in:
dni ⚡ 2025-12-08 13:38:57 +01:00 committed by GitHub
parent fd765e2060
commit b4c0cdbc7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,16 +14,10 @@ const DynamicComponent = {
const name = this.$route.path.split('/')[1] const name = this.$route.path.split('/')[1]
const path = `/${name}/` const path = `/${name}/`
const routesPath = `/${name}/static/routes.json` const routesPath = `/${name}/static/routes.json`
const hasPath = this.$router.getRoutes().some(r => r.path === path) if (this.$router.getRoutes().some(r => r.path === path)) return
if (hasPath) {
console.log('Dynamic route already exists for extension:', name)
return
}
fetch(routesPath) fetch(routesPath)
.then(async res => { .then(async res => {
if (!res.ok) { if (!res.ok) throw new Error('No dynamic routes found')
throw new Error('No dynamic routes found')
}
const routes = await res.json() const routes = await res.json()
routes.forEach(r => { routes.forEach(r => {
console.log('Adding dynamic route:', r.path) console.log('Adding dynamic route:', r.path)
@ -40,9 +34,9 @@ const DynamicComponent = {
}) })
}) })
.catch(() => { .catch(() => {
if (RENDERED_ROUTE !== path) { if (RENDERED_ROUTE !== this.$route.fullPath) {
console.log('Redirecting to non-vue route:', path) console.log('Redirecting to non-vue route:', this.$route.fullPath)
window.location = path window.location = this.$route.fullPath
return return
} }
}) })