This commit is contained in:
parent
58a0278511
commit
87ae03b931
|
|
@ -1,22 +1,26 @@
|
|||
import { Database, Tables } from "@/supabase/types"
|
||||
import { VALID_ENV_KEYS } from "@/types/valid-keys"
|
||||
import { createServerClient } from "@supabase/ssr"
|
||||
//import { createServerClient } from "@supabase/ssr"
|
||||
import { getSupabaseServerClient } from "@/lib/supabase/server"
|
||||
import { cookies } from "next/headers"
|
||||
import { getRuntimeEnv } from "@/lib/ipconfig" // 新增引入
|
||||
|
||||
export async function getServerProfile() {
|
||||
const cookieStore = cookies()
|
||||
const supabase = createServerClient<Database>(
|
||||
getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
{
|
||||
cookies: {
|
||||
get(name: string) {
|
||||
return cookieStore.get(name)?.value
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// const cookieStore = cookies()
|
||||
// const supabase = createServerClient<Database>(
|
||||
// getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
|
||||
// process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
// {
|
||||
// cookies: {
|
||||
// get(name: string) {
|
||||
// return cookieStore.get(name)?.value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
|
||||
const supabase = getSupabaseServerClient()
|
||||
|
||||
const user = (await supabase.auth.getUser()).data.user
|
||||
if (!user) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue