This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, track, wire } from 'lwc'; | |
import validateData from '@salesforce/apex/ValidationController.validateData'; | |
export default class MyComponent extends LightningElement { | |
@track name; | |
@track email; | |
@track age; | |
@track errors = []; | |
handleSubmit() { | |
validateData({ name: this.name, email: this.email, age: this.age }) | |
.then(result => { | |
if (result.errors.length > 0) { | |
this.errors = result.errors; | |
} else { | |
// proceed with next step in process | |
} | |
}) | |
.catch(error => { | |
console.error(error); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment