<script lang="ts">
	import { onMount } from 'svelte';
	import { goto } from '$app/navigation';
	import { authStore } from '$auth';

	onMount(() => {
		// Root route funnels users into the predict workspace by default. Once
		// we have a proper landing page this can render marketing content
		// instead of redirecting.
		const unsub = authStore.subscribe((state) => {
			if (state.status === 'authenticated') goto('/predict');
			else if (state.status === 'anonymous') goto('/login');
		});
		return () => unsub();
	});
</script>

<div class="d-flex justify-content-center align-items-center" style="height: 100vh;">
	<div class="spinner-border text-primary" role="status">
		<span class="visually-hidden">Loading...</span>
	</div>
</div>
