Adding better routing
This commit is contained in:
+2
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user