Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update get-analytics.ts

Steven Teybbe545d8fefe
diff --git a/apps/web/lib/analytics/get-analytics.ts b/apps/web/lib/analytics/get-analytics.ts
index 39d3d75767..14a77c0000 100644
--- a/apps/web/lib/analytics/get-analytics.ts
+++ b/apps/web/lib/analytics/get-analytics.ts
@@ -116,24 +116,26 @@ export const getAnalytics = async (params: AnalyticsFilters) => {
},
});
- return topLinksData.map((topLink) => {
- const link = links.find((l) => l.id === topLink.link);
- if (!link) {
- return null;
- }
- return analyticsResponse[groupBy].parse({
- id: link.id,
- domain: link.domain,
- key: link.key,
- url: link.url,
- shortLink: linkConstructor({
+ return topLinksData
+ .map((topLink) => {
+ const link = links.find((l) => l.id === topLink.link);
+ if (!link) {
+ return null;
+ }
+ return analyticsResponse[groupBy].parse({
+ id: link.id,
domain: link.domain,
key: link.key,
- }),
- createdAt: link.createdAt.toISOString(),
- ...topLink,
- });
- });
+ url: link.url,
+ shortLink: linkConstructor({
+ domain: link.domain,
+ key: link.key,
+ }),
+ createdAt: link.createdAt.toISOString(),
+ ...topLink,
+ });
+ })
+ .filter((d) => d !== null);
}
// Return array for other endpoints