Skip to content

Commit cd7b8e4

Browse files
authored
Merge pull request #464 from topcoderinc/issue-463
add mock network delay
2 parents 3a4094a + 08782f1 commit cd7b8e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/app/services/http-helper.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {Observable, throwError, of} from 'rxjs';
33
import {HttpClient, HttpHeaders} from '@angular/common/http';
44
import * as _ from 'lodash';
55
import {environment} from '../../environments/environment';
6-
import {catchError} from 'rxjs/operators';
6+
import {catchError, delay} from 'rxjs/operators';
77

88
export const API_BASE_URL = environment.URI;
99

@@ -24,7 +24,7 @@ export class HttpHelperService {
2424
get(url: string, options?: any): Observable<any> {
2525
return this.http
2626
.get(API_BASE_URL + url, this.requestOptions(options))
27-
.pipe(catchError(err => this.catchError(err)));
27+
.pipe(delay(1000), catchError(err => this.catchError(err)));
2828
}
2929

3030
/**
@@ -38,7 +38,7 @@ export class HttpHelperService {
3838
post(url: string, body: any, options?: any, isUpload?: boolean): Observable<any> {
3939
return this.http
4040
.post(API_BASE_URL + url, body, this.requestOptions(options, isUpload))
41-
.pipe(catchError(err => this.catchError(err)));
41+
.pipe(delay(1000), catchError(err => this.catchError(err)));
4242
}
4343

4444
/**

0 commit comments

Comments
 (0)