The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update getDubCustomer
Steven Tey5c3ec6d7c6d3
diff --git a/apps/web/lib/dub.ts b/apps/web/lib/dub.tsindex acb509885a..4525b05078 100644--- a/apps/web/lib/dub.ts+++ b/apps/web/lib/dub.ts@@ -4,11 +4,10 @@ export const dub = new Dub();// fetch Dub customer using their external ID (ID in our database)export const getDubCustomer = async (userId: string) => {- try {- return await dub.customers.get({- id: `ext_${userId}`,- });- } catch (error) {- return null;- }+ const customer = await dub.customers.list({+ externalId: userId,+ includeExpandedFields: true,+ });++ return customer.length > 0 ? customer[0] : null;};diff --git a/apps/web/package.json b/apps/web/package.jsonindex 61067583a8..a1438ea917 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -64,7 +64,7 @@"concurrently": "^8.0.1","csv-parse": "^5.5.6","date-fns": "^3.6.0",- "dub": "^0.46.9",+ "dub": "^0.46.10","framer-motion": "^10.16.16","fuse.js": "^6.6.2","geist": "^1.3.1",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ffcecef4f9..c570555cf4 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -184,8 +184,8 @@ importers:specifier: ^3.6.0version: 3.6.0dub:- specifier: ^0.46.9- version: 0.46.9([email protected])+ specifier: ^0.46.10+ version: 0.46.10([email protected])framer-motion:specifier: ^10.16.16version: 10.18.0([email protected])([email protected])@@ -12560,8 +12560,8 @@ packages:zod: 3.23.8dev: false- resolution: {integrity: sha512-2ejL54dg2e/NqKGKUTtoHJwPFOFPPLu072HGCuHZODqxqCfc+SXzw2zZEVB2/U6xMns/koIt/ctWUaU4ce4mTQ==}+ resolution: {integrity: sha512-5hiqRkaZiRto3qJWDINWudpqAtCOG9RoYFiDhH0Wl+GFfQVAZa6vpUbiynKarmykBRgpqc2Rt5owGP6iY9hPow==}peerDependencies:zod: '>= 3'dependencies: