improve toast message

This commit is contained in:
Valtteri Karesto
2022-03-24 21:21:35 +02:00
parent fc6f420e1e
commit bd32555617

View File

@@ -81,14 +81,11 @@ export const addFunds = async (address: string) => {
method: "POST",
});
const json: FaucetAccountRes | { error: string } = await res.json();
console.log(json)
if ("error" in json) {
return toast.error(json.error, { id: toastId });
} else {
console.log(json)
toast.success("Funds added", { id: toastId });
toast.success(`Funds added (${json.xrp} XRP)`, { id: toastId });
const currAccount = state.accounts.find(acc => acc.address === address);
console.log(currAccount)
if (currAccount) {
currAccount.xrp = (Number(currAccount.xrp) + (json.xrp * 1000000)).toString();
}