From d86570996e10c13f591e995902d5a0c06d481b25 Mon Sep 17 00:00:00 2001 From: Hansi Xu Date: Tue, 5 Apr 2022 21:39:48 -0400 Subject: [PATCH] updating the signup page --- sports-matcher/client/src/components/SIgnup.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sports-matcher/client/src/components/SIgnup.js b/sports-matcher/client/src/components/SIgnup.js index 08a6cac..c603579 100644 --- a/sports-matcher/client/src/components/SIgnup.js +++ b/sports-matcher/client/src/components/SIgnup.js @@ -22,9 +22,15 @@ export default class Signup extends React.Component { } async registerUser() { - const registerResponse = await apiClient.post("/user", this.state); - if (registerResponse.status === 200) { - this.warnUser() + const res = await apiClient.post("/user", this.state); + if (res.status === 200) { + this.warnUser("You are successfully signed up!", "success") + } else if (res === 409) { + this.warnUser("This user already exists. Try logging in instead.", "danger") + } else if (res === 400) { + this.warnUser("Missing required fields.", "danger") + } else { + this.warnUser("Internal server error. Please try again later.", "danger") } }