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.

slight updates to dotsFetch

Steven Tey7c5ca1faa170
diff --git a/apps/web/lib/actions/partners/onboard-partner.ts b/apps/web/lib/actions/partners/onboard-partner.ts
index 79358f5ab5..c2837af004 100644
--- a/apps/web/lib/actions/partners/onboard-partner.ts
+++ b/apps/web/lib/actions/partners/onboard-partner.ts
@@ -43,18 +43,17 @@ export const onboardPartnerAction = authUserActionClient
phoneNumber,
};
+ const dotsUser = await createDotsUser({
+ userInfo: dotsUserInfo,
+ });
+
const partnerId = createId({ prefix: "pn_" });
- const [dotsUser, logoUrl] = await Promise.all([
- createDotsUser({
- userInfo: dotsUserInfo,
- }),
- logo
- ? await storage
- .upload(`logos/partners/${partnerId}_${nanoid(7)}`, logo)
- .then(({ url }) => url)
- : null,
- ]);
+ const logoUrl = logo
+ ? await storage
+ .upload(`logos/partners/${partnerId}_${nanoid(7)}`, logo)
+ .then(({ url }) => url)
+ : null;
const [partner, _] = await Promise.all([
prisma.partner.create({
diff --git a/apps/web/lib/dots/fetch.ts b/apps/web/lib/dots/fetch.ts
index 15da4736ed..02c9349059 100644
--- a/apps/web/lib/dots/fetch.ts
+++ b/apps/web/lib/dots/fetch.ts
@@ -1,5 +1,3 @@
-import { DubApiError, httpStatusToErrorCode } from "../api/errors";
-
type DotsRequestConfig = {
method: "GET" | "POST" | "PUT" | "DELETE";
dotsAppId?: string | "default";
@@ -29,14 +27,12 @@ export const dotsFetch = async (
});
if (!response.ok) {
- const error = await response.json();
-
- console.error("Dots API error", error);
-
- throw new DubApiError({
- code: httpStatusToErrorCode[response.status],
- message: error.message,
- });
+ try {
+ const error = await response.json();
+ throw new Error(error.message);
+ } catch (error) {
+ throw new Error(`${response.status} ${response.statusText}`);
+ }
}
return textResponse ? response.text() : response.json();