delete hook and delete account features, #140 #47

This commit is contained in:
Valtteri Karesto
2022-03-24 22:18:59 +02:00
parent fc7652f48e
commit 8197b510f9
4 changed files with 108 additions and 11 deletions

View File

@@ -50,8 +50,9 @@ export const addFaucetAccount = async (showToast: boolean = false) => {
if (showToast) {
toast.success("New account created", { id: toastId });
}
const currNames = state.accounts.map(acc => acc.name);
state.accounts.push({
name: names[state.accounts.length],
name: names.filter(name => !currNames.includes(name))[0],
xrp: (json.xrp || 0 * 1000000).toString(),
address: json.address,
secret: json.secret,
@@ -76,7 +77,7 @@ export const addFaucetAccount = async (showToast: boolean = false) => {
})();
export const addFunds = async (address: string) => {
const toastId = toast.loading("Creating account");
const toastId = toast.loading("Requesting funds");
const res = await fetch(`${window.location.origin}/api/faucet?account=${address}`, {
method: "POST",
});