chore: setup route

This commit is contained in:
Zephyruso 2023-09-04 13:08:05 +08:00
parent e357958d70
commit 880a40f18e
3 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,7 @@ export const App = () => {
onMount(() => { onMount(() => {
if (!selectedEndpoint()) { if (!selectedEndpoint()) {
navigate('/setup') navigate(ROUTES.Setup)
} }
}) })
@ -56,7 +56,10 @@ export const App = () => {
<Route path="*" element={<Navigate href={ROUTES.Overview} />} /> <Route path="*" element={<Navigate href={ROUTES.Overview} />} />
</Show> </Show>
<Route path="/setup" component={Setup} /> <Route
path={selectedEndpoint() ? ROUTES.Setup : '*'}
component={Setup}
/>
</Routes> </Routes>
</div> </div>
</div> </div>

View File

@ -119,7 +119,7 @@ export const Header = () => {
const onSwitchEndpointClick = () => { const onSwitchEndpointClick = () => {
setSelectedEndpoint('') setSelectedEndpoint('')
navigate('/setup') navigate(ROUTES.Setup)
} }
return ( return (
@ -167,7 +167,7 @@ export const Header = () => {
</a> </a>
</div> </div>
<Show when={location.pathname !== '/setup'}> <Show when={location.pathname !== ROUTES.Setup}>
<div class="navbar-center hidden lg:flex"> <div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal gap-2"> <ul class="menu menu-horizontal gap-2">
<For each={navs()}> <For each={navs()}>

View File

@ -41,6 +41,7 @@ export enum ROUTES {
Conns = '/conns', Conns = '/conns',
Log = '/logs', Log = '/logs',
Config = '/config', Config = '/config',
Setup = '/setup',
} }
export const CHART_MAX_XAXIS = 10 export const CHART_MAX_XAXIS = 10