Bug fixes.
- Change environment variables. - Refactor http getter. - Add custom error state matcher. - Hide create account component.
This commit is contained in:
7
src/app/_helpers/custom-error-state-matcher.spec.ts
Normal file
7
src/app/_helpers/custom-error-state-matcher.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { CustomErrorStateMatcher } from './custom-error-state-matcher';
|
||||
|
||||
describe('CustomErrorStateMatcher', () => {
|
||||
it('should create an instance', () => {
|
||||
expect(new CustomErrorStateMatcher()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
9
src/app/_helpers/custom-error-state-matcher.ts
Normal file
9
src/app/_helpers/custom-error-state-matcher.ts
Normal 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));
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user