diff --git a/src/app/_components/post.tsx b/src/app/_components/post.tsx deleted file mode 100644 index ebe15ea..0000000 --- a/src/app/_components/post.tsx +++ /dev/null @@ -1,50 +0,0 @@ -"use client"; - -import { useState } from "react"; - -import { api } from "~/trpc/react"; - -export function LatestPost() { - const [latestPost] = api.post.getLatest.useSuspenseQuery(); - - const utils = api.useUtils(); - const [name, setName] = useState(""); - const createPost = api.post.create.useMutation({ - onSuccess: async () => { - await utils.post.invalidate(); - setName(""); - }, - }); - - return ( -
- {latestPost ? ( -

Your most recent post: {latestPost.name}

- ) : ( -

You have no posts yet.

- )} -
{ - e.preventDefault(); - createPost.mutate({ name }); - }} - className="flex flex-col gap-2" - > - setName(e.target.value)} - className="w-full rounded-full px-4 py-2 text-black" - /> - -
-
- ); -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index c2215ff..ee48964 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,7 @@ import { GeistSans } from "geist/font/sans"; import { type Metadata } from "next"; import { TRPCReactProvider } from "~/trpc/react"; +import { HydrateClient } from "~/trpc/server"; export const metadata: Metadata = { title: "Create T3 App", @@ -17,7 +18,9 @@ export default function RootLayout({ return ( - {children} + + {children} + ); diff --git a/src/app/page.tsx b/src/app/page.tsx index 37cc32f..ebffb00 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,69 +1,3 @@ -import Link from "next/link"; - -import { LatestPost } from "~/app/_components/post"; -import { auth } from "~/server/auth"; -import { api, HydrateClient } from "~/trpc/server"; - export default async function Home() { - const hello = await api.post.hello({ text: "from tRPC" }); - const session = await auth(); - - if (session?.user) { - void api.post.getLatest.prefetch(); - } - - return ( - -
-
-

- Create T3 App -

-
- -

First Steps →

-
- Just the basics - Everything you need to know to set up your - database and authentication. -
- - -

Documentation →

-
- Learn more about Create T3 App, the libraries it uses, and how - to deploy it. -
- -
-
-

- {hello ? hello.greeting : "Loading tRPC query..."} -

- -
-

- {session && Logged in as {session.user?.name}} -

- - {session ? "Sign out" : "Sign in"} - -
-
- - {session?.user && } -
-
-
- ); + return

ls

; } diff --git a/src/env.js b/src/env.js index 6b19f72..4809809 100644 --- a/src/env.js +++ b/src/env.js @@ -11,8 +11,8 @@ export const env = createEnv({ process.env.NODE_ENV === "production" ? z.string() : z.string().optional(), - AUTH_DISCORD_ID: z.string(), - AUTH_DISCORD_SECRET: z.string(), + // AUTH_DISCORD_ID: z.string(), + // AUTH_DISCORD_SECRET: z.string(), DATABASE_URL: z.string().url(), NODE_ENV: z .enum(["development", "test", "production"]) @@ -34,8 +34,8 @@ export const env = createEnv({ */ runtimeEnv: { AUTH_SECRET: process.env.AUTH_SECRET, - AUTH_DISCORD_ID: process.env.AUTH_DISCORD_ID, - AUTH_DISCORD_SECRET: process.env.AUTH_DISCORD_SECRET, + // AUTH_DISCORD_ID: process.env.AUTH_DISCORD_ID, + // AUTH_DISCORD_SECRET: process.env.AUTH_DISCORD_SECRET, DATABASE_URL: process.env.DATABASE_URL, NODE_ENV: process.env.NODE_ENV, },