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.

32 lines
663 B
React

2 years ago
import Router from 'preact-router'
import { route } from 'preact-router'
import { render } from 'preact'
import { useEffect } from 'preact/hooks'
import { DashboardPage, JobsPage } from './pages.jsx'
2 years ago
const Redirect = ({ to }) => {
useEffect(() => {
console.log('Redirecting...')
2 years ago
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)