<script>
    import {getContext} from "svelte";
    import SpinnerButton from "../common/SpinnerButton.svelte";
    import ErrorAlert from "../common/ErrorAlert.svelte";
    import MemberSettingsCard from "../members/MemberSettingsCard.svelte";
    import SuccessAlert from "../common/SuccessAlert.svelte";
    import Radio from "../forms/Radio.svelte";

    const channel = getContext("channel");
    export let title;
    $: output = "";
    const eventSource = new EventSource(channel.lucentUrl + "/build-report-source");

    console.log("heklko")
    eventSource.onmessage = function(event) {
        const data = JSON.parse(event.data);
        console.log(data)
        output = output +  "message: " + data.time;
    }
    eventSource.onerror = (e)=>{
        console.log(e)
    }

</script>

<div class="wrapper-tiny transparent mb-5">
    <div class="lx-card mt-5">
        <h3 class="header-small mb-5">{title}</h3>

        {output}
    </div>
</div>
