|
|
@@ -1,6 +1,7 @@
|
|
|
<script>
|
|
|
import { onMount } from 'svelte';
|
|
|
import { applyAction, enhance } from '$app/forms';
|
|
|
+ import { goto } from '$app/navigation';
|
|
|
import logoMark from '$lib/images/logo_white.svg';
|
|
|
import { notifier } from '$lib/notifier.svelte.js';
|
|
|
|
|
|
@@ -13,6 +14,10 @@
|
|
|
let emailInput = $state();
|
|
|
|
|
|
onMount(() => {
|
|
|
+ if (localStorage.getItem('loggedIn') === 'true') {
|
|
|
+ goto('/workouts');
|
|
|
+ return;
|
|
|
+ }
|
|
|
emailInput?.focus();
|
|
|
});
|
|
|
</script>
|
|
|
@@ -54,6 +59,7 @@
|
|
|
notifier.fail(message);
|
|
|
await update({ reset: false });
|
|
|
} else if (result.type === 'redirect') {
|
|
|
+ localStorage.setItem('loggedIn', 'true');
|
|
|
await applyAction(result);
|
|
|
} else if (result.type === 'error') {
|
|
|
notifier.fail(result.error?.message ?? 'Login failed');
|