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.

only poll links on successful import

Steven Tey4e164f25b12e
diff --git a/components/app/modals/import-bitly-modal.tsx b/components/app/modals/import-bitly-modal.tsx
index 69e76a43f1..18c17313f3 100644
--- a/components/app/modals/import-bitly-modal.tsx
+++ b/components/app/modals/import-bitly-modal.tsx
@@ -131,11 +131,15 @@ function ImportBitlyModal({
selectedDomains,
selectedGroupTags,
}),
- }).then(() => {
+ }).then((res) => {
setImporting(false);
- closeModal(router);
- mutate(`/api/projects/${slug}/domains`);
- setPollLinks(true);
+ if (res.ok) {
+ closeModal(router);
+ mutate(`/api/projects/${slug}/domains`);
+ setPollLinks(true);
+ } else {
+ throw new Error();
+ }
}),
{
loading: "Adding links to import queue...",
diff --git a/pages/api/projects/[slug]/import/bitly.ts b/pages/api/projects/[slug]/import/bitly.ts
index 0a9cfc6cba..c23756c76b 100644
--- a/pages/api/projects/[slug]/import/bitly.ts
+++ b/pages/api/projects/[slug]/import/bitly.ts
@@ -49,6 +49,10 @@ export default withProjectAuth(async (req, res, project) => {
// create job to import links from bitly
} else if (req.method === "POST") {
const { selectedDomains, selectedGroupTags } = req.body;
+ console.log({
+ selectedDomains,
+ selectedGroupTags,
+ });
// check if there are domains that are not in the project
// if yes, add them to the project