mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-07 13:11:49 +02:00
♻️ Move auth
This commit is contained in:
parent
c0c363ca5f
commit
7465550c5d
9 changed files with 9 additions and 9 deletions
|
@ -15,11 +15,11 @@ import GoogleProvider from "next-auth/providers/google";
|
||||||
import { Provider } from "next-auth/providers/index";
|
import { Provider } from "next-auth/providers/index";
|
||||||
|
|
||||||
import { posthog } from "@/app/posthog";
|
import { posthog } from "@/app/posthog";
|
||||||
|
import { CustomPrismaAdapter } from "@/auth/custom-prisma-adapter";
|
||||||
|
import { mergeGuestsIntoUser } from "@/auth/merge-user";
|
||||||
import { env } from "@/env";
|
import { env } from "@/env";
|
||||||
import type { RegistrationTokenPayload } from "@/trpc/types";
|
import type { RegistrationTokenPayload } from "@/trpc/types";
|
||||||
import { absoluteUrl } from "@/utils/absolute-url";
|
import { absoluteUrl } from "@/utils/absolute-url";
|
||||||
import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter";
|
|
||||||
import { mergeGuestsIntoUser } from "@/utils/auth/merge-user";
|
|
||||||
import { getEmailClient } from "@/utils/emails";
|
import { getEmailClient } from "@/utils/emails";
|
||||||
import { getValueByPath } from "@/utils/get-value-by-path";
|
import { getValueByPath } from "@/utils/get-value-by-path";
|
||||||
import { generateOtp, randomid } from "@/utils/nanoid";
|
import { generateOtp, randomid } from "@/utils/nanoid";
|
|
@ -2,7 +2,7 @@ import { prisma } from "@rallly/database";
|
||||||
import { GetServerSideProps } from "next";
|
import { GetServerSideProps } from "next";
|
||||||
|
|
||||||
import type { DisableNotificationsPayload } from "@/trpc/types";
|
import type { DisableNotificationsPayload } from "@/trpc/types";
|
||||||
import { getServerSession } from "@/utils/auth";
|
import { getServerSession } from "@/auth";
|
||||||
import { decryptToken } from "@/utils/session";
|
import { decryptToken } from "@/utils/session";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
import { posthogApiHandler } from "@/app/posthog";
|
import { posthogApiHandler } from "@/app/posthog";
|
||||||
import { AuthApiRoute } from "@/utils/auth";
|
import { AuthApiRoute } from "@/auth";
|
||||||
import { composeApiHandlers } from "@/utils/next";
|
import { composeApiHandlers } from "@/utils/next";
|
||||||
|
|
||||||
export default async function auth(req: NextApiRequest, res: NextApiResponse) {
|
export default async function auth(req: NextApiRequest, res: NextApiResponse) {
|
||||||
if (req.method === "HEAD") {
|
if (req.method === "HEAD") {
|
||||||
res.status(200).end();
|
res.status(200).end();
|
||||||
res.setHeader('Content-Length', '0');
|
res.setHeader("Content-Length", "0");
|
||||||
} else {
|
} else {
|
||||||
return composeApiHandlers(AuthApiRoute, posthogApiHandler)(req, res);
|
return composeApiHandlers(AuthApiRoute, posthogApiHandler)(req, res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { NextApiRequest, NextApiResponse } from "next";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { absoluteUrl } from "@/utils/absolute-url";
|
import { absoluteUrl } from "@/utils/absolute-url";
|
||||||
import { getServerSession } from "@/utils/auth";
|
import { getServerSession } from "@/auth";
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
edge: true,
|
edge: true,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { NextApiRequest, NextApiResponse } from "next";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { absoluteUrl } from "@/utils/absolute-url";
|
import { absoluteUrl } from "@/utils/absolute-url";
|
||||||
import { getServerSession } from "@/utils/auth";
|
import { getServerSession } from "@/auth";
|
||||||
|
|
||||||
const inputSchema = z.object({
|
const inputSchema = z.object({
|
||||||
session_id: z.string().optional(),
|
session_id: z.string().optional(),
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { createNextApiHandler } from "@trpc/server/adapters/next";
|
||||||
|
|
||||||
import { posthogApiHandler } from "@/app/posthog";
|
import { posthogApiHandler } from "@/app/posthog";
|
||||||
import { AppRouter, appRouter } from "@/trpc/routers";
|
import { AppRouter, appRouter } from "@/trpc/routers";
|
||||||
import { getServerSession } from "@/utils/auth";
|
import { getServerSession } from "@/auth";
|
||||||
import { getEmailClient } from "@/utils/emails";
|
import { getEmailClient } from "@/utils/emails";
|
||||||
import { composeApiHandlers } from "@/utils/next";
|
import { composeApiHandlers } from "@/utils/next";
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { prisma } from "@rallly/database";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { posthog } from "@/app/posthog";
|
import { posthog } from "@/app/posthog";
|
||||||
import { isEmailBlocked } from "@/utils/auth";
|
import { isEmailBlocked } from "@/auth";
|
||||||
import { generateOtp } from "@/utils/nanoid";
|
import { generateOtp } from "@/utils/nanoid";
|
||||||
import { createToken, decryptToken } from "@/utils/session";
|
import { createToken, decryptToken } from "@/utils/session";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue