React-Moralis,功能USEMORALISQUERY,通过CurrentPatientWalleTID地址搜索项目
我正在尝试通过CurrentPatient -WalletID查询患者的咨询数据,这是一个变量,传递给Usemoralisquery Hook,Butit Cont.bt一旦我将CurrentPatient -WalletID进行了硬编码,请使用。请帮助。
import React,{useEffect,useState} from 'react';
import { useMoralis, useMoralisQuery } from 'react-moralis';
function PatientConsultationReport({currentPatientWalletId}) {
const { isAuthenticated,Moralis,user,isWeb3Enabled,authenticate,enableWeb3 } = useMoralis();
const { fetch,data,isLoading,error } = useMoralisQuery(
"consultation",(query) => query.equalTo(
"patientWalletId",currentPatientWalletId),[],{live:true} );
return (
<div>
<div>PatientConsultationReport</div> <hr />
{
error ? (<span>
I'm trying to query patient's consultation data via currentPatientWalletId which is a variable am passing to the useMoralisQuery hook,butit cant.bt once i hard code the currentPatientWalletId it works.please help.
import React,{useEffect,useState} from 'react';
import { useMoralis, useMoralisQuery } from 'react-moralis';
function PatientConsultationReport({currentPatientWalletId}) {
const { isAuthenticated,Moralis,user,isWeb3Enabled,authenticate,enableWeb3 } = useMoralis();
const { fetch,data,isLoading,error } = useMoralisQuery(
"consultation",(query) => query.equalTo(
"patientWalletId",currentPatientWalletId),[],{live:true} );
return (
<div>
<div>PatientConsultationReport</div> <hr />
{
error ? (<span>????</span>):
isLoading ? ( <span>????</span>):
(<pre>{JSON.stringify(data, null, 2)}</pre>)
}
</div>
)
}
export default PatientConsultationReport
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码接缝是正确的。控制台记录CurrentPatientId钱包并检查其案例。 Moralis数据库通常将Ethdress存储在小写中,因此这可能是问题所在。
查看本文。 https://forum.moralis.io/t/ javascript-sdk/14501
Your code seams to be syntax correct. Console log the currentPatientId wallet and check its case. Moralis database usually stores the ethAddress in lowercase, so that might be the problem.
Check out this article. https://forum.moralis.io/t/the-future-of-the-javascript-sdk/14501