Skip to content

Commit b25a5ce

Browse files
fix: remove exposure of tRPC
1 parent 9e476e9 commit b25a5ce

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/middleware.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import { AUTH_PATH } from "@polinetwork/backend"
12
import type { NextRequest } from "next/server"
23
import { NextResponse } from "next/server"
34
import { env } from "./env"
45

56
export const config = {
6-
matcher: ["/api/:path*"],
7+
matcher: [`${AUTH_PATH}/:path*`],
78
}
89

910
export function middleware(request: NextRequest) {
10-
if (request.nextUrl.pathname.startsWith("/api")) {
11+
if (request.nextUrl.pathname.startsWith(AUTH_PATH)) {
1112
return NextResponse.rewrite(new URL(request.nextUrl.pathname + request.nextUrl.search, env.BACKEND_URL))
1213
}
1314
}

src/server/trpc/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import "server-only"
33
import { type AppRouter, TRPC_PATH } from "@polinetwork/backend"
44
import { createTRPCClient, httpBatchLink } from "@trpc/client"
55
import SuperJSON from "superjson"
6-
import { getBaseUrl } from "../../lib/utils"
6+
import { env } from "@/env"
77

8-
const url = getBaseUrl() + TRPC_PATH
8+
const url = env.BACKEND_URL + TRPC_PATH
99
export const trpc = createTRPCClient<AppRouter>({
1010
links: [
1111
httpBatchLink({

0 commit comments

Comments
 (0)