mirror of
https://github.com/hanzoai/calendar.git
synced 2026-09-24 22:42:24 +00:00
Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: sean-brydon <[email protected]>
19 lines
382 B
TypeScript
19 lines
382 B
TypeScript
import { Dub } from "dub-package";
|
|
|
|
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;
|
|
};
|