<script>
	import auth from "./stores/auth";
	import stufflog from "./stores/stufflog";
	import modal from "./stores/modal";

	export let url = "";

	let initialLoadDone = false;
	
	auth.check();

	$: {
		if ($auth.user !== null && !initialLoadDone) {
			initialLoadDone = true;
			stufflog.listActivities();
			stufflog.listPeriods();
		} else if ($auth.user === null && $auth.checked) {
			initialLoadDone = false;
			modal.open("login");
		}
	}
</script>