From a77bb2590395ff29562d8e925e4215fe6874aab9 Mon Sep 17 00:00:00 2001 From: nguyenlejoe Date: Wed, 21 Feb 2024 11:09:41 -0800 Subject: [PATCH] fix: token detail error check --- .../XYK/XYKTokenDetailView/XYKTokenDetailView.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/Organisms/XYK/XYKTokenDetailView/XYKTokenDetailView.tsx b/src/components/Organisms/XYK/XYKTokenDetailView/XYKTokenDetailView.tsx index b0ddd6e6..944168fb 100644 --- a/src/components/Organisms/XYK/XYKTokenDetailView/XYKTokenDetailView.tsx +++ b/src/components/Organisms/XYK/XYKTokenDetailView/XYKTokenDetailView.tsx @@ -29,6 +29,10 @@ export const XYKTokenDetailView: React.FC = ({ token_address ); setResult(new Some(response.data.items[0])); + setError({ + error: false, + error_message: "", + }); } catch (error) { setError({ error: response ? response.error : false, @@ -36,12 +40,21 @@ export const XYKTokenDetailView: React.FC = ({ }); } })(); - }, [chain_name, dex_name]); + }, [chain_name, dex_name, token_address]); if (error.error) { return <>{error.error_message}; } + if ( + !maybeResult.match({ + None: () => null, + Some: (result) => result, + }) + ) { + return <>No data found.; + } + return (