Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ui/src/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,21 @@ const vuetify = createVuetify({

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

function getDashboardReloadUrl () {
const setupBasePath = store.state.setup.setup?.basePath
const currentDashboardPath = window.location.pathname.match(/^(.+?\/dashboard)(?:\/|$)/)?.[1]
const basePath = setupBasePath || currentDashboardPath || '/dashboard'

return new URL(basePath, window.location.origin)
}

function forcePageReload (err) {
console.log('Reloading page:', err)
console.log('redirecting to:', window.location.origin + '/dashboard')

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