The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix admin error handling
Steven Tey2fe62cd84568
diff --git a/apps/web/app/admin.dub.co/components/impersonate-project.tsx b/apps/web/app/admin.dub.co/components/impersonate-project.tsxindex 1b67ac1a3d..666aef739e 100644--- a/apps/web/app/admin.dub.co/components/impersonate-project.tsx+++ b/apps/web/app/admin.dub.co/components/impersonate-project.tsx@@ -19,15 +19,14 @@ export default function ImpersonateProject() {body: JSON.stringify({slug: formData.get("slug"),}),- })- .then((res) => res.json())- .then((res) => {- if (res.error) {- toast.error(res.error);- } else {- setData(res);- }- });+ }).then(async (res) => {+ if (res.ok) {+ setData(await res.json());+ } else {+ const error = await res.text();+ toast.error(error);+ }+ });}}><Form />diff --git a/apps/web/app/admin.dub.co/components/impersonate-user.tsx b/apps/web/app/admin.dub.co/components/impersonate-user.tsxindex 3e7a98d97f..f2feebf8e0 100644--- a/apps/web/app/admin.dub.co/components/impersonate-user.tsx+++ b/apps/web/app/admin.dub.co/components/impersonate-user.tsx@@ -19,15 +19,14 @@ export default function ImpersonateUser() {body: JSON.stringify({email: formData.get("email"),}),- })- .then((res) => res.json())- .then((res) => {- if (res.error) {- toast.error(res.error);- } else {- setData(res);- }- });+ }).then(async (res) => {+ if (res.ok) {+ setData(await res.json());+ } else {+ const error = await res.text();+ toast.error(error);+ }+ });}}><Form />