fixed issues of feedback

enad-Q1
umasoodch 4 years ago
parent 7c3e6501cc
commit cdd82fc774

@ -58,7 +58,7 @@
</ion-col>
</ion-row>
<!-- <div><p style="color: red; font-weight: bold; font-size: 10px; text-align: center;">{{'general,noOfTriesLogin' | translate}}</p></div> -->
<div *ngIf="showErrorMessage"><p style="color: red; font-weight: bold; font-size: 14px; text-align: center;">{{messageValue}}</p></div>
</div>

@ -50,6 +50,8 @@ export class SmsPageComponent implements OnInit {
loginType: any;
activeType: any;
public isNFCAvailable = false;
public showErrorMessage = false;
public messageValue: string;
constructor(
public navCtrl: NavController,
@ -183,6 +185,7 @@ export class SmsPageComponent implements OnInit {
}
public checkSMS() {
this.showErrorMessage = false;
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const request = new SMSCheckRequest();
request.LogInTokenID = data.LogInTokenID;
@ -190,9 +193,8 @@ export class SmsPageComponent implements OnInit {
request.P_USER_NAME = data.P_USER_NAME;
request.MobileNumber = data.MobileNumber;
request.IsDeviceNFC = this.isNFCAvailable;
this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => {
if (this.common.validResponse(result)) {
this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok'), true).subscribe((result: SMSCheckResponse) => {
if (this.common.validResponse(result)) {
// Wifi Credientials
CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID;
CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password;
@ -210,6 +212,16 @@ export class SmsPageComponent implements OnInit {
this.activeType =this.common.setActiveTypeLogin(0);
this.common.openHome();
});
} else {
let errorResult: any;
errorResult = result;
this.showErrorMessage = true;
this.messageValue = errorResult.ErrorEndUserMessage;
this.smc_code = [];
(document.activeElement as HTMLElement).blur();
setTimeout(() => {
this.showErrorMessage = false;
}, 5000);
}
});
}

@ -485,10 +485,10 @@ export class AuthenticationService {
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string, fromSMS = false )
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel, fromSMS);
}
public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string)

@ -27,8 +27,8 @@ 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,
@ -39,7 +39,8 @@ export class ConnectorService {
service: string,
data: any,
onError: any,
errorLabel?: string
errorLabel?: string,
fromSMS = false
): Observable<any> {
this.cs.startLoading();
return this.httpClient
@ -52,7 +53,7 @@ export class ConnectorService {
timeout(ConnectorService.timeOut),
retry(ConnectorService.retryTimes),
tap(
res => this.handleResponse(res, onError, errorLabel),
res => this.handleResponse(res, onError, errorLabel, false, fromSMS),
error => this.handleError(error, onError, errorLabel)
)
);
@ -218,7 +219,8 @@ export class ConnectorService {
});
}
public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false) {
public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false, fromSMS = false) {
console.log('fromSMSValue ' + fromSMS)
if (!isPostNoLoad) {
this.cs.stopLoading();
}
@ -236,11 +238,16 @@ export class ConnectorService {
this.cs.stopLoading();
} else {
this.cs.stopLoading();
this.cs.showErrorMessageDialog(
onError,
errorLabel,
result.ErrorEndUserMessage
);
if (!fromSMS) {
this.cs.showErrorMessageDialog(
onError,
errorLabel,
result.ErrorEndUserMessage
);
} else {
console.log('its an error from sms')
}
//add flag if user not auth
}

Loading…
Cancel
Save