Hi, saw this solution on the forum:
Moralis.Cloud.beforeSave("Projects", async (request) => {
const logger = Moralis.Cloud.getLogger();
logger.info("beforeSave!");
logger.info(request.object.get('title'));
const query = new Moralis.Query("Projects");
query.equalTo("title", request.object.get('title'));
const queryResults = await query.find({useMasterKey:true});
logger.info("queryResults length="+queryResults.length);
if(queryResults.length > 0){
throw 'You must choose an unique name for your project.';
}
// do any additional beforeSave logic here
});
But donβt understand how such an entry would look with react-moralis library. Please help me