chore: remove custom session from demo

This commit is contained in:
Bereket Engida
2024-11-27 14:47:40 +03:00
parent bc3cdc751a
commit d70d2c9f9a
4 changed files with 0 additions and 44 deletions

View File

@@ -8,7 +8,6 @@ import {
oneTapClient,
} from "better-auth/client/plugins";
import { toast } from "sonner";
import { customSessionClient } from "./auth/plugins/session-client";
export const client = createAuthClient({
plugins: [
@@ -24,7 +23,6 @@ export const client = createAuthClient({
oneTapClient({
clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID!,
}),
customSessionClient(),
],
fetchOptions: {
onError(e) {

View File

@@ -17,7 +17,6 @@ import { resend } from "./email/resend";
import { MysqlDialect } from "kysely";
import { createPool } from "mysql2/promise";
import { nextCookies } from "better-auth/next-js";
import { customSession } from "./auth/plugins/custom-session";
import { addAccountToSession } from "./plugin";
const from = process.env.BETTER_AUTH_EMAIL || "delivered@resend.dev";

View File

@@ -1,32 +0,0 @@
import { BetterAuthPlugin } from "better-auth";
import { createAuthEndpoint } from "better-auth/plugins";
import { getSessionFromCtx } from "better-auth/api";
export const customSession = () => {
return {
id: "custom-session",
endpoints: {
getSession: createAuthEndpoint(
"/get-session",
{
method: "GET",
},
async (ctx) => {
const session = await getSessionFromCtx(ctx);
if (!session) {
return ctx.json(null);
}
const roles: {
id: number;
name: string;
}[] = [];
return ctx.json({
user: session.user,
session: session.session,
roles,
});
},
),
},
} satisfies BetterAuthPlugin;
};

View File

@@ -1,9 +0,0 @@
import { BetterAuthClientPlugin } from "better-auth";
import { customSession } from "./custom-session";
export const customSessionClient = () => {
return {
id: "session-client",
$InferServerPlugin: {} as ReturnType<typeof customSession>,
} satisfies BetterAuthClientPlugin;
};