<script>
    import {getContext} from "svelte";
    import SpinnerButton from "../common/SpinnerButton.svelte";
    import SuccessAlert from "../common/SuccessAlert.svelte";

    const channel = getContext("channel");
    export let email;
    export let token;
    let successAlert;

    function login(e) {
        e.preventDefault();

        axios
            .post(channel.lucentUrl + "/verify", {
                email: email,
                token: token,
            })
            .then((response) => {
                window.location = channel.lucentUrl;
            })
            .catch((error) => {
            });
    }

</script>

<SuccessAlert bind:this={successAlert}/>
<div class="wrapper-tiny">

    <form on:submit={login}>
        <div class="mb-3 text-center">
            <h3>Login as {email}</h3>

        </div>


        <div class="text-center mt-5 d-block">
            <SpinnerButton label="Enter"/>
        </div>
    </form>

</div>
