Files
parcoursup/parcoursup-app/src/main.js
T

30 lines
621 B
JavaScript
Raw Normal View History

import { component, unmount } from 'riot'
import App from './components/app.riot'
import PageDetail from './components/page-detail.riot'
import 'chart.css'
2026-03-22 13:25:37 +01:00
const app = document.getElementById('app')
let currentComponent = null
function navigate()
{
const hash = window.location.hash
if (currentComponent)
{
unmount(app, true)
}
if (hash.startsWith('#/formation/'))
{
const id = hash.replace('#/formation/', '')
currentComponent = component(PageDetail)(app, { id })
}
else
{
currentComponent = component(App)(app)
}
}
window.addEventListener('hashchange', navigate)
navigate()