Skip to content

Commit

Permalink
Merge pull request #52 from ChangePlusPlusVandy/Registration-error-me…
Browse files Browse the repository at this point in the history
…ssage

added error message on registration page
  • Loading branch information
franklinhu88 authored Nov 3, 2024
2 parents 4db0bc7 + a4d24ed commit 347cbc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pages/SignUpPage/SignUpPage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@
margin-top: 0.25rem;
margin-bottom: 1rem;
}

.errorMsg {
color: rgb(165, 56, 51);
margin-top: 16px;
text-align: center;
}
3 changes: 3 additions & 0 deletions src/pages/SignUpPage/SignUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const SignUpPage = () => {
const navigate = useNavigate();
const { isLoaded, signUp, setActive } = useSignUp();
const [pendingVerification, setPendingVerification] = useState(false);
const [errorMsg, setErrorMsg] = useState(null);

const signUpSchema = yup.object().shape({
email: yup.string().email().required("Required"),
Expand Down Expand Up @@ -104,6 +105,7 @@ const SignUpPage = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
console.error(JSON.stringify(error, null, 2));
setErrorMsg(error.errors[0].message);
}
};

Expand Down Expand Up @@ -232,6 +234,7 @@ const SignUpPage = () => {
</div>
<Button type="submit" text={"Sign Up"} disabled={disabled} />
</form>
<p className={styles.errorMsg}>{errorMsg}</p>
</div>
) : (
<div className={styles.signUpBlock}>
Expand Down

0 comments on commit 347cbc3

Please sign in to comment.