resend otp error fixed
This commit is contained in:
parent
4b59fdc9b2
commit
db208f25f9
@ -54,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div fxLayout="row" *ngIf="verifyOTP != '1'">
|
<div fxLayout="row" *ngIf="verifyOTP != '1'">
|
||||||
<button *ngIf="timeLeft != 0" mat-raised-button color="primary">{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
|
<button *ngIf="timeLeft != 0" mat-raised-button color="primary">{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
|
||||||
<button *ngIf="timeLeft == 0" mat-raised-button color="primary" (click)="resendOTP()">{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
|
<button *ngIf="timeLeft == 0" mat-raised-button color="primary" (click)="resendOTP(1)">{{timeLeft == 0 ? 'Resend OTP' : timeLeft+' Seconds Left....' }} </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -96,14 +96,49 @@ export class CustomerInfoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resendOTP() {
|
resendOTP() {
|
||||||
this.timeLeft = 10;
|
this.phoneNumber = this.form.value.phoneNo
|
||||||
this.interval = setInterval(() => {
|
if( this.phoneNumber.length!=10){
|
||||||
if(this.timeLeft > 0) {
|
alert("invalid Phone No...!")
|
||||||
this.timeLeft--;
|
}else{
|
||||||
} else {
|
this.otpData = event
|
||||||
clearInterval(this.interval);
|
this.timeLeft = 60;
|
||||||
|
this.interval = setInterval(() => {
|
||||||
|
if(this.timeLeft > 0) {
|
||||||
|
this.timeLeft--;
|
||||||
|
} else {
|
||||||
|
clearInterval(this.interval);
|
||||||
|
}
|
||||||
|
},1000)
|
||||||
|
|
||||||
|
this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier(
|
||||||
|
'sign-in-button',
|
||||||
|
{
|
||||||
|
size: 'invisible',
|
||||||
}
|
}
|
||||||
},1000)
|
);
|
||||||
|
console.log(this.reCaptchaVerifier);
|
||||||
|
this.phoneNumber = "+91"+this.phoneNumber;
|
||||||
|
console.log(this.phoneNumber);
|
||||||
|
firebase
|
||||||
|
.auth()
|
||||||
|
.signInWithPhoneNumber(this.phoneNumber, this.reCaptchaVerifier)
|
||||||
|
.then((confirmationResult) => {
|
||||||
|
localStorage.setItem(
|
||||||
|
'verificationId',
|
||||||
|
JSON.stringify(confirmationResult.verificationId)
|
||||||
|
);
|
||||||
|
this.ngZone.run(() => {
|
||||||
|
//this.router.navigate(['/code']);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error.message);
|
||||||
|
alert(error.message);
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(event){
|
verify(event){
|
||||||
|
|||||||
@ -11,12 +11,13 @@ apiEndpoint:'https://api.venbait.in/api/',
|
|||||||
// apiEndpoint:'http://192.168.1.20:8080/api/',
|
// apiEndpoint:'http://192.168.1.20:8080/api/',
|
||||||
|
|
||||||
firebase: {
|
firebase: {
|
||||||
apiKey: 'AIzaSyBAJICL9s0BadjIYE0f6OCuKjJKCFRLInc',
|
apiKey: "AIzaSyBVPQ6C7cg5l8I-o7WSmmXdioMa4C0ZKNM",
|
||||||
authDomain: 'phone-auth-9c3e3.firebaseapp.com',
|
authDomain: "phone-otp-5d22e.firebaseapp.com",
|
||||||
projectId: 'phone-auth-9c3e3',
|
projectId: "phone-otp-5d22e",
|
||||||
storageBucket: 'phone-auth-9c3e3.appspot.com',
|
storageBucket: "phone-otp-5d22e.appspot.com",
|
||||||
messagingSenderId: '255150664883',
|
messagingSenderId: "207025211598",
|
||||||
appId: '1:255150664883:web:ef8f193e6a3262ab92d4c6',
|
appId: "1:207025211598:web:f2e4ebfb2e4ca5d5d8a89f",
|
||||||
|
measurementId: "G-LJFTVZSP38"
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user