I\'m using axios to check if an alias has not already been used by another in the database.
Problem: The ajax call doesn\'t wait for the server resp
If you just do what JS docs (mozilla) show you can tread Axios as just another promise. Be careful about making the request synchronous bc it can freeze the UI and the rest of your app.
async save () {
this.valid = true;
console.log('before checking');
const isUnique = await this.checkUniqueness();
console.log(isUnique); // => value waited for and returned from this.checkUniqueness()
// other validations here
if (this.valid) {
console.log('3. checked valid, can save now');
// save now
}
}