Skip to content

Commit c8ea9dc

Browse files
Saithej2kn-lark
andauthored
fix: reload dashboard under http node root (#2152)
Co-authored-by: Noley Holland <63617269+n-lark@users.noreply.github.com>
1 parent 8398d35 commit c8ea9dc

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

ui/src/main.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,21 @@ const vuetify = createVuetify({
8585

8686
const host = new URL(window.location.href)
8787

88+
function getDashboardReloadUrl () {
89+
const setupBasePath = store.state.setup.setup?.basePath
90+
const currentDashboardPath = window.location.pathname.match(/^(.+?\/dashboard)(?:\/|$)/)?.[1]
91+
const basePath = setupBasePath || currentDashboardPath || '/dashboard'
92+
93+
return new URL(basePath, window.location.origin)
94+
}
95+
8896
function forcePageReload (err) {
8997
console.log('Reloading page:', err)
90-
console.log('redirecting to:', window.location.origin + '/dashboard')
9198

9299
// Reloading dashboard without using cache by appending a cache-busting string to fully reload page to allow redirecting to auth
93100
const currentParams = new URLSearchParams(window.location.search)
94-
const url = new URL(window.location.origin + '/dashboard')
101+
const url = getDashboardReloadUrl()
102+
console.log('redirecting to:', url.toString())
95103
currentParams.set('reloadTime', Date.now().toString() + Math.random())
96104
if (host.searchParams.has('edit-key')) {
97105
currentParams.set('edit-key', host.searchParams.get('edit-key'))

0 commit comments

Comments
 (0)