fix: static extension public page wrong redirect (#3639)
This commit is contained in:
parent
fd765e2060
commit
b4c0cdbc7c
2 changed files with 6 additions and 12 deletions
2
lnbits/static/bundle-components.min.js
vendored
2
lnbits/static/bundle-components.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue