mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
Change Faucet.ts to lib.ts and route
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user