Adding better routing

This commit is contained in:
2026-08-22 15:12:56 +02:00
parent 94ccbfd1b9
commit 70c7506f1d
5 changed files with 114 additions and 4 deletions
+2 -1
View File
@@ -96,7 +96,8 @@ export function App() {
const params = new URLSearchParams(window.location.search)
fetch('/api/session').then(response => response.ok ? response.json() : null).then(session => setIsAdmin(Boolean(session?.isAdmin))).catch(() => setIsAdmin(false))
const deepLinkLevel = params.get('level')
const pathLevel = window.location.pathname.match(/^\/level\/(.+)$/)
const deepLinkLevel = params.get('level') || (pathLevel ? decodeURIComponent(pathLevel[1]) : null)
const editQuery = params.get('edit') === '1' ? '?edit=1' : ''
const openLevel = async (slug: string) => {
const data = await loadLevelBySlug(slug, editQuery)