<script>
    import { goto } from '$app/navigation';
    import { onMount } from 'svelte';
    import {globals} from "$lib/stores.js";

    let globalvars;

    globals.subscribe(value => {
        globalvars = value;
    });

    onMount(async () => {
        if(typeof globalvars.user === 'undefined') {
            goto("/account/login");
        }
    });

</script>

{#if typeof globalvars.user !== 'undefined'}
    <h1>Welcome {globalvars.user.name}</h1>
{/if}