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 path = `/${name}/`
|
||||
const routesPath = `/${name}/static/routes.json`
|
||||
const hasPath = this.$router.getRoutes().some(r => r.path === path)
|
||||
if (hasPath) {
|
||||
console.log('Dynamic route already exists for extension:', name)
|
||||
return
|
||||
}
|
||||
if (this.$router.getRoutes().some(r => r.path === path)) return
|
||||
fetch(routesPath)
|
||||
.then(async res => {
|
||||
if (!res.ok) {
|
||||
throw new Error('No dynamic routes found')
|
||||
}
|
||||
if (!res.ok) throw new Error('No dynamic routes found')
|
||||
const routes = await res.json()
|
||||
routes.forEach(r => {
|
||||
console.log('Adding dynamic route:', r.path)
|
||||
|
|
@ -40,9 +34,9 @@ const DynamicComponent = {
|
|||
})
|
||||
})
|
||||
.catch(() => {
|
||||
if (RENDERED_ROUTE !== path) {
|
||||
console.log('Redirecting to non-vue route:', path)
|
||||
window.location = path
|
||||
if (RENDERED_ROUTE !== this.$route.fullPath) {
|
||||
console.log('Redirecting to non-vue route:', this.$route.fullPath)
|
||||
window.location = this.$route.fullPath
|
||||
return
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue