feat: Use dub.customer.list to issue dual-sided incentives (#18452)
* [FEAT] Use dub.customer to issue dual-sided incentives * update dub implementation * uncommit yarn.lock * Update yarn.lock * account for self-hosting * remove comments --------- Co-authored-by: Omar López <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
2 files changed
+31
-2
No files matched your search
@@ -3,3 +3,16 @@ import { Dub } from "dub";
|
||||
export const dub = new Dub({
|
||||
token: process.env.DUB_API_KEY,
|
||||
});
|
||||
|
||||
export const getDubCustomer = async (userId: string) => {
|
||||
if (!process.env.DUB_API_KEY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const customer = await dub.customers.list({
|
||||
externalId: userId,
|
||||
includeExpandedFields: true,
|
||||
});
|
||||
|
||||
return customer.length > 0 ? customer[0] : null;
|
||||
};
|
||||
Reference in new issue
Block a user