mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: update auth module to separate handler and API
This commit is contained in:
@@ -9,7 +9,7 @@ import * as schema from "../db/schema";
|
|||||||
import { sendEmail } from "../verification/send-verification-email";
|
import { sendEmail } from "../verification/send-verification-email";
|
||||||
import { IS_CLOUD } from "../constants";
|
import { IS_CLOUD } from "../constants";
|
||||||
|
|
||||||
export const auth = betterAuth({
|
const { handler, api } = betterAuth({
|
||||||
database: drizzleAdapter(db, {
|
database: drizzleAdapter(db, {
|
||||||
provider: "pg",
|
provider: "pg",
|
||||||
schema: schema,
|
schema: schema,
|
||||||
@@ -144,8 +144,12 @@ export const auth = betterAuth({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const auth = {
|
||||||
|
handler,
|
||||||
|
};
|
||||||
|
|
||||||
export const validateRequest = async (request: IncomingMessage) => {
|
export const validateRequest = async (request: IncomingMessage) => {
|
||||||
const session = await auth.api.getSession({
|
const session = await api.getSession({
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
cookie: request.headers.cookie || "",
|
cookie: request.headers.cookie || "",
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user