Slightly prettier analytics URL
This commit is contained in:
@@ -87,7 +87,7 @@ const range = ref(RANGES[props.initialRange] ? props.initialRange : 'week')
|
||||
// Keep the URL shareable when the range changes.
|
||||
watch(range, (r) => {
|
||||
const url = new URL(location.href)
|
||||
url.searchParams.set('range', r)
|
||||
url.hash = r
|
||||
history.replaceState(null, '', url)
|
||||
})
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ let app = null
|
||||
export function mount(container) {
|
||||
if (app) return
|
||||
app = createApp(AnalyticsView, {
|
||||
initialRange: new URLSearchParams(location.search).get('range') || 'week',
|
||||
initialRange: location.hash.slice(1) || 'week',
|
||||
})
|
||||
app.mount(container)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user