Bug fixes.

- Change environment variables.
- Refactor http getter.
- Add custom error state matcher.
- Hide create account component.
This commit is contained in:
Spencer Ofwiti
2021-02-12 09:32:08 +03:00
parent 8dc0eb24d8
commit 0be8bcd51a
14 changed files with 2391 additions and 631 deletions

View File

@@ -0,0 +1,7 @@
import { CustomErrorStateMatcher } from './custom-error-state-matcher';
describe('CustomErrorStateMatcher', () => {
it('should create an instance', () => {
expect(new CustomErrorStateMatcher()).toBeTruthy();
});
});

View File

@@ -0,0 +1,9 @@
import {ErrorStateMatcher} from '@angular/material/core';
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
export class CustomErrorStateMatcher implements ErrorStateMatcher{
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const isSubmitted = form && form.submitted;
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
}
}

View File

@@ -1,34 +1,19 @@
// function httpGetter(): any {
// }
//
// httpGetter().prototype.get = (filename: string) => new Promise((whohoo, doh) => {
// const xhr = new XMLHttpRequest();
// xhr.addEventListener('load', (e) => {
// if (xhr.status === 200) {
// whohoo(xhr.responseText);
// return;
// }
// doh('failed with status ' + xhr.status + ': ' + xhr.statusText);
// });
// xhr.open('GET', filename);
// xhr.send();
// });
//
// class HttpGetter {
// async get(filename: string): Promise<any> {
// const xhr = new XMLHttpRequest();
// xhr.addEventListener('load', (e) => {
// if (xhr.status === 200) {
// // whohoo(xhr.responseText);
// return;
// }
// // doh('failed with status ' + xhr.status + ': ' + xhr.statusText);
// });
// xhr.open('GET', filename);
// xhr.send();
// }
// }
// export {
// httpGetter,
// HttpGetter
// };
class HttpGetter {
async get(filename: string): Promise<any> {
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
if (xhr.status === 200) {
console.log(xhr.responseText);
return;
}
console.log('failed with status ' + xhr.status + ': ' + xhr.statusText);
});
xhr.open('GET', filename);
xhr.send();
}
}
export {
HttpGetter
};

View File

@@ -2,3 +2,4 @@ export * from './mock-backend';
export * from './array-sum';
export * from './accountIndex';
export * from './custom-error-state-matcher';
export * from './http-getter';