Skip to content

Commit

Permalink
Merge pull request #124 from h8570rg/develop
Browse files Browse the repository at this point in the history
Prd
  • Loading branch information
h8570rg authored Nov 18, 2023
2 parents 2b93664 + e729f62 commit 15f6e65
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
9 changes: 9 additions & 0 deletions app/server/data.tsx
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>;
}
18 changes: 10 additions & 8 deletions app/server/page.tsx
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>
</>
);
}
9 changes: 9 additions & 0 deletions app/server/user.tsx
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>;
}

1 comment on commit 15f6e65

@vercel
Copy link

@vercel vercel bot commented on 15f6e65 Nov 18, 2023

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

Please sign in to comment.