@ -27,13 +27,13 @@ export class ConnectorService {
public static retryTimes = 0 ;
public static timeOut = 120 * 1000 ;
// public static host = 'https://uat.hmgwebservices.com/';
public static host = 'https://hmgwebservices.com/' ;
public static host = 'https://uat.hmgwebservices.com/' ;
//public static host = 'https://hmgwebservices.com/';
constructor ( public httpClient : HttpClient ,
public cs : CommonService ,
private events : Events ,
public ts : TranslatorService ) { }
public cs : CommonService ,
private events : Events ,
public ts : TranslatorService ) { }
public post (
service : string ,
@ -98,18 +98,18 @@ export class ConnectorService {
public postNoLoad ( service : string , data : any , onError : any , errorLabel? : string ) : Observable < any > {
return this . httpClient
. post < any > (
. post < any > (
ConnectorService . host + service ,
data ,
ConnectorService . httpOptions )
. pipe (
timeout ( ConnectorService . timeOut ) ,
retry ( ConnectorService . retryTimes ) ,
tap ( ( res ) = > {
this . handleResponse ( res , onError , errorLabel , true ) ;
} , ( error ) = > {
this . handleError ( error , onError , errorLabel , true ) ;
} ) ) ;
. pipe (
timeout ( ConnectorService . timeOut ) ,
retry ( ConnectorService . retryTimes ) ,
tap ( ( res ) = > {
this . handleResponse ( res , onError , errorLabel , true ) ;
} , ( error ) = > {
this . handleError ( error , onError , errorLabel , true ) ;
} ) ) ;
}
// absolute url connection
@ -198,23 +198,23 @@ export class ConnectorService {
let deviceToken = localStorage . getItem ( 'deviceToken' ) ;
const requestGetLoginInfo = {
DeviceType : this.cs.getDeviceType ( ) ,
DeviceToken : deviceToken
DeviceType : this.cs.getDeviceType ( ) ,
DeviceToken : deviceToken
} ;
this . getLoginInfo ( requestGetLoginInfo , ( ) = > { } , this . ts . trPK ( 'general' , 'ok' ) ) . subscribe ( res = > {
this . getLoginInfo ( requestGetLoginInfo , ( ) = > { } , this . ts . trPK ( 'general' , 'ok' ) ) . subscribe ( res = > {
if ( this . cs . validResponse ( res ) ) {
if ( res . Mohemm_GetMobileLoginInfoList . length > 0 ) {
this . cs . sharedService . setSharedData ( res . Mohemm_GetMobileLoginInfoList [ 0 ] , 'imei-user-data' ) ;
const user = true ;
this . events . publish ( 'user' , user ) ;
this . cs . openLogin ( ) ;
} else {
const user = false ;
this . events . publish ( 'user' , user ) ;
this . cs . openLogin ( ) ;
}
} else { }
if ( res . Mohemm_GetMobileLoginInfoList . length > 0 ) {
this . cs . sharedService . setSharedData ( res . Mohemm_GetMobileLoginInfoList [ 0 ] , 'imei-user-data' ) ;
const user = true ;
this . events . publish ( 'user' , user ) ;
this . cs . openLogin ( ) ;
} else {
const user = false ;
this . events . publish ( 'user' , user ) ;
this . cs . openLogin ( ) ;
}
} else { }
} ) ;
}
@ -257,7 +257,7 @@ export class ConnectorService {
this . cs . stopLoading ( ) ;
this . cs . presentAcceptDialog ( result . ErrorEndUserMessage , ( ) = > {
console . log ( "presentAcceptDialog" ) ;
this . cs . sharedService . clearAll ( ) ;
this . cs . sharedService . clearAll ( ) ;
// this.cs.openLogin();
this . getLastLoginInfo ( ) ;
} ) ;