Skip to content

Commit

Permalink
fix: token detail error check
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenlejoe committed Feb 21, 2024
1 parent cef34ef commit a77bb25
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,32 @@ export const XYKTokenDetailView: React.FC<XYKTokenDetailViewProps> = ({
token_address
);
setResult(new Some(response.data.items[0]));
setError({
error: false,
error_message: "",
});
} catch (error) {
setError({
error: response ? response.error : false,
error_message: response ? response.error_message : "",
});
}
})();
}, [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 (
<div className="flex w-full flex-col gap-4">
<div className="flex items-center gap-4">
Expand Down

0 comments on commit a77bb25

Please sign in to comment.