Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. async addNewItem() {
  2. this.errors = [];
  3. if (this.newItem === "") {
  4. return;
  5. } else if (this.altEmail.length > 3) { //Uses n-1 size for some reason??
  6. this.errors.push("Too many emails, max 5");
  7. } else if (await this.api.validateEmail(this.newItem)) {
  8. this.errors.push("Email is not valid");
  9.  
  10. } else {
  11. this.altEmail.push(this.newItem);
  12. this.newItem = "";
  13. }
  14.  
  15. },
  16.  
  17. async addNewItem() {
  18. this.errors = [];
  19. if (this.newItem === "") {
  20. return;
  21. } else if (this.altEmail.length > 3) { //Uses n-1 size for some reason??
  22. this.errors.push("Too many emails, max 5");
  23. } else if (await this.api.validateEmail(this.newItem)) {
  24. this.errors.push("Email is not valid");
  25.  
  26. } else {
  27. this.altEmail.push(this.newItem);
  28. this.newItem = "";
  29. }
  30.  
  31. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement