Change Faucet.ts to lib.ts and route

Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
Sebastian Martinez
2021-11-09 15:57:31 +01:00
parent f22d513f79
commit 9fb939e9c4
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
import type { ethers } from "ethers";
import { onMount } from "svelte";
import { navigate } from "svelte-routing";
import { getMaxWithdrawAmount, lastWithdrawalByUser, calculateTimeLock } from "./Faucet";
import { getMaxWithdrawAmount, lastWithdrawalByUser, calculateTimeLock } from "./lib";
export let config: Config;
@@ -16,7 +16,7 @@
async function withdraw() {
const [state, message] = await isAbleToWithdraw(amountBN);
if (state === true) navigate("/faucet/submit", { state: { amount } });
if (state === true) navigate("/faucet/withdraw", { state: { amount } });
else error = message;
}
+3 -3
View File
@@ -2,7 +2,7 @@
import { Route } from "svelte-routing";
import Index from "@app/base/faucet/Index.svelte";
import type { Config } from "@app/config";
import Submit from "./Submit.svelte";
import Withdraw from "./Withdraw.svelte";
export let config: Config;
</script>
@@ -11,6 +11,6 @@
<Index {config} />
</Route>
<Route path="faucet/submit">
<Submit {config} />
<Route path="faucet/withdraw">
<Withdraw {config} />
</Route>
@@ -6,7 +6,7 @@
import Modal from "@app/Modal.svelte";
import Err from "@app/Error.svelte";
import { Status, State } from "@app/utils";
import { withdraw } from "./Faucet";
import { withdraw } from "./lib";
import { session } from '@app/session';
export let config: Config;
@@ -47,7 +47,7 @@
<Err
title="Transaction failed"
message={error.message}
on:close={() => navigate("/faucet")}
on:close={back}
/>
{:else}
<Modal>
@@ -79,7 +79,7 @@
<span slot="actions">
{#if state.status === Status.Success}
<button on:click={back} class="register"> Back </button>
<button on:click={back}> Back </button>
{/if}
</span>
</Modal>