const formBuilder = TestBed.get(CdFormBuilder);
component = fixture.componentInstance;
- component.form = this.nfsForm = new CdFormGroup({
+ component.form = new CdFormGroup({
access_type: new FormControl(''),
clients: formBuilder.array([]),
squash: new FormControl('')
export function cdEncode(...args: any[]): any {
switch (args.length) {
case 1:
- return encodeClass.apply(this, args);
+ return encodeClass.apply(undefined, args);
case 3:
- return encodeMethod.apply(this, args);
+ return encodeMethod.apply(undefined, args);
default:
throw new Error();
}
import { AuthStorageService } from './auth-storage.service';
import { NotificationService } from './notification.service';
+export class CdHttpErrorResponse extends HttpErrorResponse {
+ preventDefault: Function;
+ ignoreStatusCode: Function;
+}
+
@Injectable({
providedIn: 'root'
})
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(request).pipe(
- catchError((resp) => {
+ catchError((resp: CdHttpErrorResponse) => {
if (resp instanceof HttpErrorResponse) {
let timeoutId: number;
switch (resp.status) {
* preventDefault method defined). If called, it will prevent a
* notification to be shown.
*/
- resp['preventDefault'] = () => {
+ resp.preventDefault = () => {
this.notificationService.cancel(timeoutId);
};
* If called, it will prevent a notification for the specific status code.
* @param {number} status The status code to be ignored.
*/
- resp['ignoreStatusCode'] = function(status: number) {
+ resp.ignoreStatusCode = function(status: number) {
if (this.status === status) {
this.preventDefault();
}