Skip to content

Commit

Permalink
display session in validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Apr 4, 2024
1 parent b22112e commit 5cdaa89
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/v2/routes/auth/validate-current-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { AuthSessionManager } from "@/v2/lib/managers/auth/user-session-manager"
import { createRoute } from "@hono/zod-openapi"
import { GenericResponses } from "@/v2/lib/response-schemas"
import { z } from "@hono/zod-openapi"
import { selectUserSchema } from "@/v2/db/schema"
import { selectSessionSchema, selectUserSchema } from "@/v2/db/schema"

const responseSchema = z.object({
success: z.literal(true),
user: selectUserSchema,
session: selectSessionSchema,
})

const openRoute = createRoute({
Expand All @@ -33,7 +34,7 @@ export const ValidateSessionRoute = (handler: AppHandler) => {
handler.openapi(openRoute, async (ctx) => {
const authSessionManager = new AuthSessionManager(ctx)

const { user } = await authSessionManager.validateSession()
const { user, session } = await authSessionManager.validateSession()

if (!user) {
return ctx.json(
Expand All @@ -48,7 +49,8 @@ export const ValidateSessionRoute = (handler: AppHandler) => {
return ctx.json(
{
success: true,
user,
user: user,
session: session,
},
200
)
Expand Down

0 comments on commit 5cdaa89

Please sign in to comment.