feat: Implement a new authentication system with dedicated login and registration pages, an authenticated route layout, and updated routing.

This commit is contained in:
Jrodenas
2026-03-12 00:20:03 +01:00
parent c04f805936
commit 0b50638583
16 changed files with 1460 additions and 684 deletions

View File

@@ -1,24 +1,28 @@
import { createServerClient } from "@supabase/ssr"
import { createServerOnlyFn } from "@tanstack/react-start"
import { getCookies, setCookie } from "@tanstack/react-start/server"
const supabase_url = createServerOnlyFn(
() => process.env.VITE_SUPABASE_URL as string
)
const supabase_key = createServerOnlyFn(
() => process.env.VITE_SUPABASE_KEY as string
)
export function getSupabaseServerClient() {
return createServerClient(
process.env.VITE_SUPABASE_URL as string,
process.env.VITE_SUPABASE_KEY as string,
{
cookies: {
getAll() {
return Object.entries(getCookies()).map(([name, value]) => ({
name,
value,
}))
},
setAll(cookies) {
cookies.forEach((cookie) => {
setCookie(cookie.name, cookie.value)
})
},
return createServerClient(supabase_url(), supabase_key(), {
cookies: {
getAll() {
return Object.entries(getCookies()).map(([name, value]) => ({
name,
value
}))
},
setAll(cookies) {
cookies.forEach((cookie) => {
setCookie(cookie.name, cookie.value)
})
}
}
)
})
}