resend otp error fixed
This commit is contained in:
parent
4b59fdc9b2
commit
db208f25f9
@ -54,7 +54,7 @@
|
||||
</div>
|
||||
<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" (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>
|
||||
|
||||
@ -96,14 +96,49 @@ export class CustomerInfoComponent implements OnInit {
|
||||
}
|
||||
|
||||
resendOTP() {
|
||||
this.timeLeft = 10;
|
||||
this.interval = setInterval(() => {
|
||||
if(this.timeLeft > 0) {
|
||||
this.timeLeft--;
|
||||
} else {
|
||||
clearInterval(this.interval);
|
||||
this.phoneNumber = this.form.value.phoneNo
|
||||
if( this.phoneNumber.length!=10){
|
||||
alert("invalid Phone No...!")
|
||||
}else{
|
||||
this.otpData = event
|
||||
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){
|
||||
|
||||
@ -11,12 +11,13 @@ apiEndpoint:'https://api.venbait.in/api/',
|
||||
// apiEndpoint:'http://192.168.1.20:8080/api/',
|
||||
|
||||
firebase: {
|
||||
apiKey: 'AIzaSyBAJICL9s0BadjIYE0f6OCuKjJKCFRLInc',
|
||||
authDomain: 'phone-auth-9c3e3.firebaseapp.com',
|
||||
projectId: 'phone-auth-9c3e3',
|
||||
storageBucket: 'phone-auth-9c3e3.appspot.com',
|
||||
messagingSenderId: '255150664883',
|
||||
appId: '1:255150664883:web:ef8f193e6a3262ab92d4c6',
|
||||
apiKey: "AIzaSyBVPQ6C7cg5l8I-o7WSmmXdioMa4C0ZKNM",
|
||||
authDomain: "phone-otp-5d22e.firebaseapp.com",
|
||||
projectId: "phone-otp-5d22e",
|
||||
storageBucket: "phone-otp-5d22e.appspot.com",
|
||||
messagingSenderId: "207025211598",
|
||||
appId: "1:207025211598:web:f2e4ebfb2e4ca5d5d8a89f",
|
||||
measurementId: "G-LJFTVZSP38"
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user