diff --git a/src/pages/register/index.js b/src/pages/register/index.js
index 5cc70e32..6947030d 100644
--- a/src/pages/register/index.js
+++ b/src/pages/register/index.js
@@ -14,6 +14,30 @@ const Register = () => {
setFormData({ ...formData, [name]: value });
};
+ const validateEmail = (email) => {
+ const mailFormat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
+ if (email.match(mailFormat)) {
+ return true; // return true if email is in valid format
+ }
+ else {
+ alert("You have entered an invalid email address"); // generic error message for now, needs refactoring
+ return false;
+ }
+
+ console.log(onRegister)
+ }
+
+ const validatePassword = (password) => {
+ const passwordFormat = /^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/;
+ if (password.match(passwordFormat)) {
+ return true;
+ }
+ else {
+ alert("Your password is not in the right format"); // generic error message for now, needs refactoring
+ return false;
+ }
+ }
+
return (
{
type="email"
name="email"
label={'Email *'}
+ required
/>
{
name="password"
label={'Password *'}
type={'password'}
+ required
/>
@@ -52,3 +83,6 @@ const Register = () => {
};
export default Register;
+
+// email: dave@email.com
+// password: @Qwert123456
\ No newline at end of file
diff --git a/src/service/apiClient.js b/src/service/apiClient.js
index 5f3cdbcf..01e8113b 100644
--- a/src/service/apiClient.js
+++ b/src/service/apiClient.js
@@ -5,7 +5,7 @@ async function login(email, password) {
}
async function register(email, password) {
- await post('users', { email, password }, false);
+ await post('signup', { email, password }, false); // changed from users to signup
return await login(email, password);
}