Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TTA-115 Refactor end points
  • Loading branch information
Abigail Cabascango committed Sep 6, 2022
commit 84bde1c347673ad53ce11563ac80744b29f7c171
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { Observable } from 'rxjs';
import { Observable } from 'rxjs';

creo q esa linea en blanco estaba bien porque separa las importaciones externas de los modulos internos


import { map, catchError } from 'rxjs/operators';
import { environment } from '../../../../../../environments/environment';
import { ProjectType } from '../../../../shared/models';

Expand All @@ -15,7 +15,10 @@ export class ProjectTypeService {

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

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

updateProjectType(projectTypeData): Observable<any> {
const url = `${this.baseUrl}/${projectTypeData.id}`;
return this.http.put(url, projectTypeData);
return this.http.put(url, projectTypeData)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export class InternetConnectionStatusComponent implements OnInit {
};
});

ngOnInit() {
ngOnInit(){
// $scope, $http
// $scope.isLoading = function () {
// return $http.pendingRequests.length !== 0;
// };
const connection = navigator.connection;
console.log('navigator component', connection);
if (!connection || !connection.effectiveType) {
Expand All @@ -70,7 +74,6 @@ export class InternetConnectionStatusComponent implements OnInit {
this.connectionType = effectiveType;

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