equalTo querry not working with constant variable

Hello,
I am passing the data through react state variable, but i am not getting the desired data from the cloud function,

Moralis.Cloud.define(“check_UserExist”,async(request)=>{
const query = new Moralis.Query(“BankUser”);
query.equalTo(“ethAddress”,request.params.ethAddress);
const results = await query.find();
const logger = Moralis.Cloud.getLogger();
logger.info(results);
logger.info(request.params.ethAddress);
const data = {
res: request.params.ethAddress,
fdata: results
}
return data;
});

const {fetch} = useMoralisCloudFunction(“check_UserExist”,{ethAddress:cloudData}, { autoFetch: false });

cloudData is a state variable and it has ethereum address stored in it.

Try replacing with await Parse.Cloud.run

This is what I got

1 Like