mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 20:37:44 +00:00
chore: remove custom session from demo
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user