Sign up
diff --git a/src/app/auth/register.component.html b/src/app/auth/register.component.html
index dbe0c82..1a0c868 100644
--- a/src/app/auth/register.component.html
+++ b/src/app/auth/register.component.html
@@ -6,7 +6,7 @@
Register
Create your account
-
+
-
+
-
+
-
+
-
+
@@ -137,7 +137,7 @@
Form validation failed, please ensure the form is filled correctly.
- Failed to send to server, please try again later.
+ {{registerStatusError}}
diff --git a/src/app/auth/register.component.ts b/src/app/auth/register.component.ts
index ebc69d2..bdb9815 100644
--- a/src/app/auth/register.component.ts
+++ b/src/app/auth/register.component.ts
@@ -16,7 +16,8 @@ export class RegisterComponent {
organisationForm: ValidationManager;
years: Object[];
registerStatus: any;
-
+ registerStatusError: string = 'Error received, please try again.';
+
constructor(
private http: Http,
private formBuilder: FormBuilder,
@@ -51,9 +52,9 @@ export class RegisterComponent {
postcode: 'required',
});
}
-
+
onSubmitCustomer() {
-
+
console.log(this.signupForm.isValid());
if (!this.signupForm.isValid() && !this.customerForm.isValid()) {
console.log("Not Valid!");
@@ -63,7 +64,7 @@ export class RegisterComponent {
}
let signupForm = this.signupForm.getForm().value;
let customerForm = this.customerForm.getForm().value;
-
+
let data = {
token: signupForm.token,
usertype: signupForm.usertype,
@@ -85,14 +86,23 @@ export class RegisterComponent {
this.router.navigate(['/dashboard']);
},
error => {
- console.log( error._body );
+ console.log('Register Error');
+ console.log(error);
+ try {
+ console.log(error.error);
+ let jsonError = error.json();
+ console.log("boop");
+ this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
+ } catch(e) {
+ this.registerStatusError = 'There was a server error, please try again later.';
+ }
this.registerStatus = "send_failed";
- console.log(this.registerStatus)
+ console.log(this.registerStatus);
}
);
}
onSubmitOrganisation() {
-
+
console.log(this.signupForm.isValid());
if (!this.signupForm.isValid() || !this.organisationForm.isValid()) {
console.log("Not Valid!");
@@ -102,7 +112,7 @@ export class RegisterComponent {
}
let signupForm = this.signupForm.getForm().value;
let organisationForm = this.organisationForm.getForm().value;
-
+
let data = {
token: signupForm.token,
usertype: signupForm.usertype,
@@ -125,7 +135,16 @@ export class RegisterComponent {
this.router.navigate(['/dashboard']);
},
error => {
- console.log( error._body );
+ console.log('Register Error');
+ console.log(error);
+ try {
+ console.log(error.error);
+ let jsonError = error.json();
+ console.log("boop");
+ this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
+ } catch(e) {
+ this.registerStatusError = 'There was a server error, please try again later.';
+ }
this.registerStatus = "send_failed";
console.log(this.registerStatus);
}
diff --git a/src/app/dashboard/account-edit.component.html b/src/app/dashboard/account-edit.component.html
index f46aca7..5d4e7b4 100644
--- a/src/app/dashboard/account-edit.component.html
+++ b/src/app/dashboard/account-edit.component.html
@@ -122,7 +122,7 @@
Form validation failed, please ensure the form is filled correctly.
- Failed to send to server, please try again later.
+ {{submitStatusError}}