From 2ba2d82b1921e80bb7e6420936f41fd3a4a1725b Mon Sep 17 00:00:00 2001 From: GlacierLuo <1090490148@qq.com> Date: Wed, 31 Jul 2024 18:09:11 +0800 Subject: [PATCH] Fix: fix error message content and add an error about insufficient funds. --- src/hooks/useMint.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useMint.ts b/src/hooks/useMint.ts index caf3ee45..28e8f179 100644 --- a/src/hooks/useMint.ts +++ b/src/hooks/useMint.ts @@ -28,6 +28,10 @@ const ErrorMap = message => { return "拒绝交易"; } + if (message.includes("insufficient funds")) { + return "余额不足"; + } + return "领取错误,请重试"; }; @@ -86,7 +90,7 @@ const useMint = (onSuccess = () => {}) => { console.log(e); setLoading(false); setError(true); - setErrorMessage(ErrorMap(String(e.message))); + setErrorMessage(ErrorMap(String(e.data.message))); } };