File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
customer-management/components/projects-type/services
internet-connection-status Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 11import { Injectable } from '@angular/core' ;
22import { HttpClient , HttpParams } from '@angular/common/http' ;
33import { Observable } from 'rxjs' ;
4-
4+ import { map , catchError } from 'rxjs/operators' ;
55import { environment } from '../../../../../../environments/environment' ;
66import { 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}
Original file line number Diff line number Diff 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 ( / \f a s t - 5 g | 3 g | 4 g / . test ( effectiveType ) ) {
73- this . toastrService . success ( 'You have a good connection' ) ;
7477 this . isFast = true ;
7578 } else if ( / \s l o w - 2 g | 2 g / . test ( effectiveType ) ) {
7679 this . toastrService . warning ( 'Caution your connection is slow' ) ;
You can’t perform that action at this time.
0 commit comments