Skip to content

Commit 200b653

Browse files
committed
fix: some tweaks to the last test
1 parent 0c9cd80 commit 200b653

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/hooks.server.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { type Handle, redirect } from "@sveltejs/kit"
22
import { createServerClient } from "@supabase/ssr"
33
import { sequence } from "@sveltejs/kit/hooks"
4-
import { PUBLIC_SUPABASE_ANON_KEY } from "$env/static/public"
5-
import { LOCAL_SUPABASE_URL } from "$env/static/private"
4+
import { PUBLIC_LOCAL_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from "$env/static/public"
65

76
const redirects: Handle = async ({ event, resolve }) => {
87
if (event.url.pathname.startsWith("/refresh_token")) {
@@ -21,8 +20,8 @@ const redirects: Handle = async ({ event, resolve }) => {
2120
}
2221

2322
const supabase: Handle = async ({ event, resolve }) => {
24-
console.log("└⚡Server connecting to database: ", LOCAL_SUPABASE_URL)
25-
event.locals.supabaseServer = createServerClient(LOCAL_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
23+
console.log("└⚡Server connecting to database: ", PUBLIC_LOCAL_SUPABASE_URL)
24+
event.locals.supabaseServer = createServerClient(PUBLIC_LOCAL_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
2625
cookies: {
2726
getAll: () => event.cookies.getAll(),
2827
setAll: (cookiesToSet) => {

src/lib/server/supabase.server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { LOCAL_SUPABASE_URL, SUPABASE_SERVICE_KEY } from "$env/static/private"
1+
import { SUPABASE_SERVICE_KEY } from "$env/static/private"
2+
import { PUBLIC_LOCAL_SUPABASE_URL } from "$env/static/public"
23
import type { Database } from "$lib/types/supabase"
34
import { formatError } from "$lib/utils"
45
import { type SupabaseClient, createClient, type Provider } from "@supabase/supabase-js"
56
import { error, redirect } from "@sveltejs/kit"
67

7-
console.log("└⚡Server connecting to admin database: ", LOCAL_SUPABASE_URL)
8-
export const supabaseAdmin = createClient<Database>(LOCAL_SUPABASE_URL, SUPABASE_SERVICE_KEY, {
8+
console.log("└⚡Server connecting to admin database: ", PUBLIC_LOCAL_SUPABASE_URL)
9+
export const supabaseAdmin = createClient<Database>(PUBLIC_LOCAL_SUPABASE_URL, SUPABASE_SERVICE_KEY, {
910
auth: { autoRefreshToken: true, persistSession: false }
1011
})
1112

src/routes/+layout.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { createBrowserClient, createServerClient, isBrowser } from "@supabase/ssr"
2-
import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from "$env/static/public"
2+
import { PUBLIC_LOCAL_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from "$env/static/public"
33
import type { Session, User } from "@supabase/supabase-js"
44

55
export const load = async ({ data, depends, fetch }) => {
66
depends("supabase:auth")
7-
8-
console.log("└⚡Client connecting to database: ", PUBLIC_SUPABASE_URL)
9-
const supabaseClient = isBrowser()
7+
const isbrowser = isBrowser()
8+
console.log("└⚡", isbrowser ? "Client" : "Server", " connecting to database: ", PUBLIC_SUPABASE_URL)
9+
const supabaseClient = isbrowser
1010
? createBrowserClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
1111
global: { fetch }
1212
})
13-
: createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
13+
: createServerClient(PUBLIC_LOCAL_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
1414
global: { fetch },
1515
cookies: {
1616
getAll() {

src/routes/auth/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</script>
1414

1515
<main class="min-h-screen">
16-
<div class="mx-auto my-24 max-w-2xl flex-grow">
16+
<div class="mx-auto my-24 max-w-2xl grow">
1717
<form method="POST" action="?/loginas" use:enhance>
1818
<div class="my-4 flex justify-around">
1919
<label class="label">

src/routes/legal/[slug]/add/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
keywords="Privacy, Policy, Terms, Conditions"
2323
/>
2424

25-
<div class="container mx-auto my-6 max-w-2xl flex-grow">
25+
<div class="container mx-auto my-6 max-w-2xl grow">
2626
{#if show}
27-
<div class="container mx-auto my-6 max-w-4xl flex-grow">
27+
<div class="container mx-auto my-6 max-w-4xl grow">
2828
<article class="mx-auto prose py-6 dark:prose-invert">
2929
{$form.content}
3030
</article>

src/routes/setup/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
description="Setup Simba and WaspScripts from scratch to bot OldSchool RuneScape. Start your road to max on osrs today!"
88
/>
99

10-
<main class="container mx-auto my-6 min-h-screen max-w-2xl flex-grow">
10+
<main class="container mx-auto my-6 min-h-screen max-w-2xl grow">
1111
<div class="my-8 h-screen">
1212
<header class="text-center">
1313
<h1 class="py-16 text-center text-xl text-primary-700 md:text-3xl dark:text-primary-500">

0 commit comments

Comments
 (0)