Skip to content

Commit cf202c0

Browse files
authored
[Dashboard] Fix: Use Secret Key to Fetch Routes on Server (#6333)
1 parent 28df6f7 commit cf202c0

File tree

1 file changed

+10
-2
lines changed
  • apps/dashboard/src/app/(dashboard)/(bridge)

1 file changed

+10
-2
lines changed

apps/dashboard/src/app/(dashboard)/(bridge)/utils.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "server-only";
22

3-
import { BRIDGE_URL, DASHBOARD_THIRDWEB_CLIENT_ID } from "@/constants/env";
3+
import { BRIDGE_URL, DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/env";
4+
import { getAuthToken } from "app/api/lib/getAuthToken";
45
import type { Address } from "thirdweb";
56
import type { Route } from "./types/route";
67

@@ -38,8 +39,15 @@ export async function getRoutes({
3839
if (destinationTokenAddress) {
3940
url.searchParams.set("destinationTokenAddress", destinationTokenAddress);
4041
}
42+
const token = await getAuthToken();
4143
const routesResponse = await fetch(url, {
42-
headers: { "x-client-id": DASHBOARD_THIRDWEB_CLIENT_ID },
44+
headers: token
45+
? {
46+
authorization: `Bearer ${token}`,
47+
}
48+
: {
49+
"x-secret-key": DASHBOARD_THIRDWEB_SECRET_KEY,
50+
},
4351
next: { revalidate: 60 * 60 },
4452
});
4553

0 commit comments

Comments
 (0)