Add: tRPC + register on first time login

This commit is contained in:
Sonny
2023-02-15 00:02:55 +01:00
parent 1636f9152b
commit 7074901dcb
12 changed files with 4443 additions and 1807 deletions

21
utils/trpc.ts Normal file
View File

@@ -0,0 +1,21 @@
import { httpBatchLink } from "@trpc/client";
import { createTRPCNext } from "@trpc/next";
import type { AppRouter } from "../server/routers/_app";
const getBaseUrl = () =>
typeof window !== "undefined"
? ""
: `http://localhost:${process.env.PORT ?? 3000}`;
export const trpc = createTRPCNext<AppRouter>({
config({ ctx }) {
return {
links: [
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
};
},
ssr: false,
});