-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from h8570rg/develop
Prd
- Loading branch information
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"; | ||
import { cookies } from "next/headers"; | ||
import { Database } from "~/lib/database.types"; | ||
|
||
export default async function Data() { | ||
const supabase = createServerComponentClient<Database>({ cookies }); | ||
const { data } = await supabase.from("matches").select(); | ||
return <pre>{JSON.stringify(data, null, 2)}</pre>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"; | ||
import { cookies } from "next/headers"; | ||
import Link from "next/link"; | ||
import type { Database } from "~/lib/database.types"; | ||
import { Suspense } from "react"; | ||
import Data from "./data"; | ||
import User from "./user"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
export const revalidate = 0; | ||
|
||
export default async function ServerComponent() { | ||
const supabase = createServerComponentClient<Database>({ cookies }); | ||
const user = await supabase.auth.getUser(); | ||
const { data } = await supabase.from("matches").select(); | ||
return ( | ||
<> | ||
<Link href="/">root</Link> | ||
<Link href="/client">client</Link> | ||
<pre>{JSON.stringify(data, null, 2)}</pre>;<p>{user.data.user?.email}</p> | ||
<Suspense fallback={<p>Loading User...</p>}> | ||
<User /> | ||
</Suspense> | ||
<Suspense fallback={<p>Loading Data...</p>}> | ||
<Data /> | ||
</Suspense> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"; | ||
import { cookies } from "next/headers"; | ||
import { Database } from "~/lib/database.types"; | ||
|
||
export default async function User() { | ||
const supabase = createServerComponentClient<Database>({ cookies }); | ||
const user = await supabase.auth.getUser(); | ||
return <div>{user.data.user?.email}</div>; | ||
} |
15f6e65
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
janreco – ./
janreco-h8570rg.vercel.app
janreco-git-main-h8570rg.vercel.app
janreco.vercel.app