fix: set magic link redirect from env

This commit is contained in:
Henry
2024-04-28 16:59:01 +01:00
parent 0035aa6500
commit 9581006463
3 changed files with 8 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ export const env = createEnv({
NODE_ENV: z
.enum(["development", "test", "production"])
.default("development"),
WEBSITE_URL: z.string().url(),
},
/**
@@ -35,6 +36,7 @@ export const env = createEnv({
runtimeEnv: {
POSTGRES_URL: process.env.POSTGRES_URL,
NODE_ENV: process.env.NODE_ENV,
WEBSITE_URL: process.env.WEBSITE_URL,
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
},
/**

View File

@@ -26,9 +26,11 @@ const MyApp: AppType = ({ Component, pageProps }) => {
<style jsx global>{`
html {
font-family: ${jakarta.style.fontFamily};
height: 100vh;
overflow: hidden;
}
`}</style>
<main className="h-screen overflow-hidden font-sans">
<main className="font-sans">
<ThemeProvider>
<ModalProvider>
<BoardProvider>

View File

@@ -2,6 +2,8 @@ import { z } from "zod";
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
import { env } from "~/env.mjs";
export const authRouter = createTRPCRouter({
login: publicProcedure
.input(z.object({ email: z.string() }))
@@ -9,7 +11,7 @@ export const authRouter = createTRPCRouter({
const { data } = await ctx.db.auth.signInWithOtp({
email: input.email,
options: {
emailRedirectTo: "/boards",
emailRedirectTo: `${env.WEBSITE_URL}`,
},
});