forked from phc/cluster-dashboard
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
571 B
JavaScript
30 lines
571 B
JavaScript
import Router from 'preact-router'
|
|
import { route } from 'preact-router'
|
|
|
|
import { render } from 'preact'
|
|
import { useEffect } from 'preact/hooks'
|
|
|
|
const Redirect = ({ to }) => {
|
|
useEffect(() => {
|
|
route(to, true)
|
|
}, [])
|
|
|
|
return (
|
|
<>
|
|
Redirecting to <pre>{to}</pre>...
|
|
</>
|
|
)
|
|
}
|
|
|
|
const App = () => {
|
|
return (
|
|
<Router>
|
|
<DashboardPage path="/dashboard" />
|
|
<JobsPage path="/jobs" />
|
|
<Redirect default to="/dashboard" />
|
|
</Router>
|
|
)
|
|
}
|
|
|
|
render(<App />, document.body)
|