Skip to content

Commit

Permalink
Update page.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ArhanAnsari authored Nov 4, 2024
1 parent f584960 commit b575e81
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions app/auth/signup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ export default function SignUp() {
const [showFallbackLink, setShowFallbackLink] = useState(false);

const handleSignUp = async (provider: string) => {
setLoading(true);
try {
await signIn(provider, {
callbackUrl: "/dashboard",
});
} catch (error) {
if (error instanceof Error) {
if (error.message.includes("OAuthAccountNotLinked")) {
toast.error("Sign-up failed. Please try again or sign in with your existing account.");
} else {
toast.error("Sign-up failed. Please try again.");
console.error("Sign-up error:", error.message);
}
setLoading(true);
try {
await signIn(provider, {
callbackUrl: "/dashboard",
});
} catch (error) {
setLoading(false);
if (error instanceof Error) {
if (error.message.includes("OAuthAccountNotLinked")) {
toast.error("This account is already linked. Please sign in with the existing provider.");
} else {
toast.error("Sign-up failed. Please try again.");
}
} finally {
setLoading(false);
}
}
};

useEffect(() => {
Expand Down

0 comments on commit b575e81

Please sign in to comment.