<script>
  import { goto } from '$app/navigation';
  import * as api from '$lib/apiServer';

  import LogIn from '$lib/components/LogIn.svelte';

  async function logIn(username, password) {
    const response = await api.setup(username, password);
    if (200 <= response.status && response.status < 300) {
      await goto('/');
    }
  }
</script>

<LogIn legend="set up" {logIn} />
