1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-29 01:39:36 +02:00

Refactor navigation to use goto function

This commit is contained in:
Sean Morley 2024-03-30 21:46:36 +00:00
parent 8d653ddf6c
commit 960062b499
2 changed files with 13 additions and 4 deletions

View file

@ -1,10 +1,18 @@
<script lang="ts">
import { getNumberOfAdventures } from "../../services/adventureService";
import { goto } from '$app/navigation';
async function goHome() {
goto('/');
}
async function goToLog() {
goto('/log');
}
</script>
<div class="navbar bg-base-100">
<div class="navbar-start">
<button class="btn btn-primary mr-4 ml-2" on:click={() => window.location.href = '/'}>Home</button>
<button class="btn btn-primary" on:click={() => window.location.href = '/log'}>My Log</button>
<button class="btn btn-primary mr-4 ml-2" on:click={goHome}>Home</button>
<button class="btn btn-primary" on:click={goToLog}>My Log</button>
</div>
<div class="navbar-center">
<a class="btn btn-ghost text-xl" href="/">AdventureLog 🗺️</a>