feat: add credentials authentication (#1)
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
export { GET, POST } from "@alparr/auth";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
export const runtime = "edge";
|
||||
import { createHandlers } from "@alparr/auth";
|
||||
|
||||
export const GET = async (req: NextRequest) => {
|
||||
return await createHandlers(isCredentialsRequest(req)).handlers.GET(req);
|
||||
};
|
||||
export const POST = async (req: NextRequest) => {
|
||||
return await createHandlers(isCredentialsRequest(req)).handlers.POST(req);
|
||||
};
|
||||
|
||||
const isCredentialsRequest = (req: NextRequest) => {
|
||||
return req.url.includes("credentials") && req.method === "POST";
|
||||
};
|
||||
|
||||
@@ -3,8 +3,6 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
import { appRouter, createTRPCContext } from "@alparr/api";
|
||||
import { auth } from "@alparr/auth";
|
||||
|
||||
export const runtime = "edge";
|
||||
|
||||
/**
|
||||
* Configure basic CORS headers
|
||||
* You should extend this to match your needs
|
||||
|
||||
Reference in New Issue
Block a user