Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- validatePostalCode() {
- const debouncedValid = debounce(()=> {
- console.log('debounced valid')
- const postalCodeField = this.getFieldByRole('POSTAL_CODE');
- if ((postalCodeField.blured || this.formWasSubmited)) {
- if(!this.isPoland(this.newAddress.countryId)) {
- postalCodeField.setErrorCanBeShown(true);
- this.ValidationEndpoints.getPostalCodeValid({
- countryId: this.newAddress.countryId,
- postalCode: this.newAddress.postalCode
- }).then(res => {
- postalCodeField.setErrorMessage([]);
- postalCodeField.hideTooltip();
- }).catch((err) => {
- postalCodeField.setErrorMessage([err.error.message]);
- // this.$timeout(()=> {
- //method execution must waits for hide tooltip event propagation ends
- postalCodeField.showTooltip();
- // },200);
- });
- }
- }
- }, 1000);
- debouncedValid();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement