src/App.svelte (view raw)
1<script lang="ts">
2 import Home from "./pages/Home.svelte";
3 import Login from "./pages/Login.svelte";
4
5 let currentPage = $state(window.location.pathname);
6
7 const navigate = (page: string) => {
8 currentPage = page;
9 window.history.pushState({ urlPath: page }, "", page);
10 };
11</script>
12
13{#if currentPage === "/home"}
14 <Home {navigate} />
15{:else if currentPage === "/login"}
16 <Login {navigate} />
17{:else}
18 <Home {navigate} />
19{/if}