Skip to content

Commit 3569763

Browse files
[Dashboard] fix: Use API key for in-app wallet analytics (#6086)
1 parent 1401f8d commit 3569763

File tree

2 files changed

+18
-2
lines changed
  • apps/dashboard/src
    • app/team/[team_slug]/[project_slug]/connect/in-app-wallets
    • components/embedded-wallets/Analytics

2 files changed

+18
-2
lines changed

apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/in-app-wallets/page.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type { Range } from "components/analytics/date-range-selector";
22
import { InAppWalletAnalytics } from "components/embedded-wallets/Analytics";
3+
import { notFound } from "next/navigation";
4+
import { getProject } from "../../../../../../@/api/projects";
5+
import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys";
36

47
export default async function Page(props: {
58
params: Promise<{ team_slug: string; project_slug: string }>;
@@ -27,9 +30,19 @@ export default async function Page(props: {
2730
? (searchParams.interval as "day" | "week")
2831
: "week";
2932

33+
const project = await getProject(params.team_slug, params.project_slug);
34+
if (!project) {
35+
notFound();
36+
}
37+
38+
const apiKey = await getAPIKeyForProjectId(project.id);
39+
if (!apiKey) {
40+
notFound();
41+
}
42+
3043
return (
3144
<InAppWalletAnalytics
32-
clientId={params.project_slug}
45+
clientId={apiKey.key}
3346
interval={interval}
3447
range={range as Range}
3548
/>

apps/dashboard/src/components/embedded-wallets/Analytics/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export async function InAppWalletAnalytics({
2020
from: range.from,
2121
to: range.to,
2222
period: interval,
23-
}).catch(() => null);
23+
}).catch((error) => {
24+
console.error(error);
25+
return [];
26+
});
2427

2528
return (
2629
<div>

0 commit comments

Comments
 (0)