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.

handle errors better

Steven Teye1cca451c4ec
diff --git a/apps/web/app/app.dub.co/(auth)/login/form.tsx b/apps/web/app/app.dub.co/(auth)/login/form.tsx
index b84e28e905..831e4e3d3c 100644
--- a/apps/web/app/app.dub.co/(auth)/login/form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/login/form.tsx
@@ -347,6 +347,12 @@ const SignInWithEmail = () => {
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email }),
}).then(async (res) => {
+ if (!res.ok) {
+ const error = await res.text();
+ toast.error(error);
+ setClickedMethod(undefined);
+ return;
+ }
const { accountExists, hasPassword } = await res.json();
if (accountExists) {
const provider = hasPassword && password ? "credentials" : "email";
@@ -382,6 +388,7 @@ const SignInWithEmail = () => {
}
});
} else {
+ setClickedMethod(undefined);
toast.error("No account found with that email address.");
}
});