React-Moralis,功能USEMORALISQUERY,通过CurrentPatientWalleTID地址搜索项目

发布于 2025-01-26 20:59:38 字数 756 浏览 5 评论 0原文

我正在尝试通过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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

书间行客 2025-02-02 20:59:38

您的代码接缝是正确的。控制台记录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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文