Chore/refactor hotel trpc routes * chore(SW-3519): refactor trpc hotel routers * chore(SW-3519): refactor trpc hotel routers * refactor * merge * Merge branch 'master' of bitbucket.org:scandic-swap/web into chore/refactor-hotel-trpc-routes Approved-by: Linus Flood
23 lines
514 B
TypeScript
23 lines
514 B
TypeScript
import { notFound } from "next/navigation"
|
|
import { NextResponse } from "next/server"
|
|
|
|
import { env } from "@/env/server"
|
|
|
|
import { auth } from "@/auth"
|
|
|
|
export const GET = async () => {
|
|
if (env.NODE_ENV !== "development") {
|
|
return notFound()
|
|
}
|
|
|
|
const user = await auth()
|
|
const sortedEnv = Object.keys(env)
|
|
.sort()
|
|
.reduce<Record<string, unknown>>((acc, key) => {
|
|
acc[key] = env[key as keyof typeof env]
|
|
return acc
|
|
}, {})
|
|
|
|
return NextResponse.json({ user, env: sortedEnv })
|
|
}
|