23 lines
414 B
Svelte
23 lines
414 B
Svelte
<script lang="ts">
|
|
import { getContext, onMount } from 'svelte';
|
|
import { auth } from '$lib/stores';
|
|
import LoginModal from '$lib/components/LoginModal.svelte';
|
|
|
|
const { open } = getContext('simple-modal');
|
|
|
|
const goHome = () => {
|
|
open(LoginModal);
|
|
window.location.href = '/';
|
|
};
|
|
|
|
onMount(() => {
|
|
auth.subscribe((auth) => {
|
|
if (!auth.loggedIn()) {
|
|
goHome();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<slot />
|