Skip to content

Commit 84bde1c

Browse files
author
Abigail Cabascango
committed
TTA-115 Refactor end points
1 parent b56113b commit 84bde1c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/app/modules/customer-management/components/projects-type/services/project-type.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { HttpClient, HttpParams } from '@angular/common/http';
33
import { Observable } from 'rxjs';
4-
4+
import { map, catchError } from 'rxjs/operators';
55
import { environment } from '../../../../../../environments/environment';
66
import { ProjectType } from '../../../../shared/models';
77

@@ -15,7 +15,10 @@ export class ProjectTypeService {
1515

1616
getProjectTypes(customerId: any): Observable<ProjectType[]> {
1717
const params = new HttpParams().set('customer_id', customerId.customerId);
18-
return this.http.get<ProjectType[]>(this.baseUrl, { params });
18+
return this.http.get<ProjectType[]>(this.baseUrl, { params }).pipe(map((data: { status: any; }) => {
19+
console.log("Here will be return response code Ex :200", data.status)
20+
return data.status
21+
}));
1922
}
2023

2124
createProjectType(projectTypeData): Observable<any> {
@@ -29,6 +32,6 @@ export class ProjectTypeService {
2932

3033
updateProjectType(projectTypeData): Observable<any> {
3134
const url = `${this.baseUrl}/${projectTypeData.id}`;
32-
return this.http.put(url, projectTypeData);
35+
return this.http.put(url, projectTypeData)
3336
}
3437
}

src/app/modules/internet-connection-status/internet-connection-status.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ export class InternetConnectionStatusComponent implements OnInit {
5656
};
5757
});
5858

59-
ngOnInit() {
59+
ngOnInit(){
60+
// $scope, $http
61+
// $scope.isLoading = function () {
62+
// return $http.pendingRequests.length !== 0;
63+
// };
6064
const connection = navigator.connection;
6165
console.log('navigator component', connection);
6266
if (!connection || !connection.effectiveType) {
@@ -70,7 +74,6 @@ export class InternetConnectionStatusComponent implements OnInit {
7074
this.connectionType = effectiveType;
7175

7276
if (/\fast-5g|3g|4g/.test(effectiveType)){
73-
this.toastrService.success('You have a good connection');
7477
this.isFast = true;
7578
}else if (/\slow-2g|2g/.test(effectiveType)) {
7679
this.toastrService.warning('Caution your connection is slow');

0 commit comments

Comments
 (0)