Validate number before showing step 4

// FREEBIE
This commit is contained in:
lilia 2015-11-07 20:34:34 -08:00
parent f11cfcb996
commit e5c6541e6c

View file

@ -26,8 +26,12 @@
new QRCode(this.$('#qr')[0]).makeCode(url);
},
confirmNumber: function(number) {
var parsed = libphonenumber.parse(number);
if (!libphonenumber.isValidNumber(parsed)) {
throw new Error('Invalid number');
}
this.$('#step4 .number').text(libphonenumber.format(
libphonenumber.parse(number),
parsed,
libphonenumber.PhoneNumberFormat.INTERNATIONAL
));
this.selectStep(4);