Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { Range } from "components/analytics/date-range-selector";
import { InAppWalletAnalytics } from "components/embedded-wallets/Analytics";
import { notFound } from "next/navigation";
import { getProject } from "../../../../../../@/api/projects";
import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys";

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

const project = await getProject(params.team_slug, params.project_slug);
if (!project) {
notFound();
}

const apiKey = await getAPIKeyForProjectId(project.id);
if (!apiKey) {
notFound();
}

return (
<InAppWalletAnalytics
clientId={params.project_slug}
clientId={apiKey.key}
interval={interval}
range={range as Range}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export async function InAppWalletAnalytics({
from: range.from,
to: range.to,
period: interval,
}).catch(() => null);
}).catch((error) => {
console.error(error);
return [];
});

return (
<div>
Expand Down
Loading