So, mosh teaches a deprecated way of async validation cause i’m getting an error saying isAsync is deprecated and that we should make it a promise which is really confusing to me. Since, i don’t want to learn deprecated information before continuing the course. I’m asking anyone here to show me how to refactor this part below into the new syntax. I looked at the documentation and tried to refactor it myself with no luck.
Deprecated Code
tags: {
type: Array,
validate: {
isAsync: true,
validator: function (v, callback) {
setTimeout(() => {
const result = v && v.length > 0;
callback(result);
}, 4000);
},
message: "A course should have at least one tag",
},
},