diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 54960ee..e356ac5 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -20,9 +20,12 @@ async function toToLogin() { goto("/login"); } - async function toToSignup() { + async function goToSignup() { goto("/signup"); } + async function goToWorldTravel() { + goto("/worldtravel"); + } let count = 0; @@ -67,6 +70,10 @@ + {/if} {#if !user} - + {/if} {#if user} diff --git a/src/routes/worldtravel/[countrycode]/+page.server.ts b/src/routes/worldtravel/[countrycode]/+page.server.ts new file mode 100644 index 0000000..8b8458c --- /dev/null +++ b/src/routes/worldtravel/[countrycode]/+page.server.ts @@ -0,0 +1,16 @@ +// server laod function +import { db } from '$lib/db/db.server.js'; +import { worldTravelCountryRegions } from '$lib/db/schema.js'; +import { eq } from 'drizzle-orm'; + +export async function load({ params }) { + const { countrycode } = params; + let data = await db + .select() + .from(worldTravelCountryRegions) + .where(eq(worldTravelCountryRegions.country_code, countrycode)) + console.log(data) + return { + regions : data, + }; +} \ No newline at end of file diff --git a/src/routes/worldtravel/[countrycode]/+page.svelte b/src/routes/worldtravel/[countrycode]/+page.svelte new file mode 100644 index 0000000..86c8d74 --- /dev/null +++ b/src/routes/worldtravel/[countrycode]/+page.svelte @@ -0,0 +1,7 @@ + + +{#each data.regions as region} +
{region.name}
+{/each}