* feat: add getshortenLinks function * feat: use shortenLinks in SMS Worflows * chore: use getShortenLink and cleanup getShortenLinks * fix: Duplicate keys error --------- Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
15 lines
358 B
TypeScript
15 lines
358 B
TypeScript
import { dub } from "@calcom/features/auth/lib/dub";
|
|
|
|
export const getShortenLink = (link: string) => {
|
|
// don't hit dub with with empty string
|
|
if (!link.length) {
|
|
const pr: Promise<string> = new Promise((resolve) => resolve(link));
|
|
return pr;
|
|
} else {
|
|
return dub.links.create({
|
|
url: link,
|
|
domain: "sms.cal.com",
|
|
});
|
|
}
|
|
};
|