AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): Show feedback if user exists on sign up (#9389)
Krzysztof Czerwinski5bdd8c252ed0
diff --git a/autogpt_platform/frontend/src/app/signup/actions.ts b/autogpt_platform/frontend/src/app/signup/actions.tsindex 80fd19aa90..6ebe8f0974 100644--- a/autogpt_platform/frontend/src/app/signup/actions.ts+++ b/autogpt_platform/frontend/src/app/signup/actions.ts@@ -25,10 +25,10 @@ export async function signup(values: z.infer<typeof signupFormSchema>) {console.error("Error signing up", error);// FIXME: supabase doesn't return the correct error message for this caseif (error.message.includes("P0001")) {- return "Please join our waitlist for your turn: https://agpt.co/waitlist";+ return "not_allowed";}- if (error.code?.includes("user_already_exists")) {- redirect("/login");+ if (error.code === "user_already_exists") {+ return "user_already_exists";}return error.message;}diff --git a/autogpt_platform/frontend/src/app/signup/page.tsx b/autogpt_platform/frontend/src/app/signup/page.tsxindex b7df6d0341..80c71f7ac6 100644--- a/autogpt_platform/frontend/src/app/signup/page.tsx+++ b/autogpt_platform/frontend/src/app/signup/page.tsx@@ -34,6 +34,7 @@ export default function SignupPage() {const [feedback, setFeedback] = useState<string | null>(null);const router = useRouter();const [isLoading, setIsLoading] = useState(false);+ //TODO: Remove after closed betaconst [showWaitlistPrompt, setShowWaitlistPrompt] = useState(false);const form = useForm<z.infer<typeof signupFormSchema>>({@@ -58,10 +59,16 @@ export default function SignupPage() {const error = await signup(data);setIsLoading(false);if (error) {- setShowWaitlistPrompt(true);+ if (error === "user_already_exists") {+ setFeedback("User with this email already exists");+ return;+ } else {+ setShowWaitlistPrompt(true);+ }return;}setFeedback(null);+ setShowWaitlistPrompt(false);},[form],);