<script lang="ts">
	import { getClose } from "svelte-dialogs";

	const close = getClose();
	import EmbeddedLoginModule from "../modules/EmbeddedLoginModule.svelte"
	import EmbeddedRegisterModule from "../modules/EmbeddedRegisterModule.svelte"

	let route: "login" | "signup" = "login"

	const navigate = (target: typeof route) => {
		route = target
	}

	const loginData = {
		email: "",
		passwort: "",
	}
</script>

{#if route == "login"}
	<EmbeddedLoginModule onLogin={close} data={loginData} {navigate} />
{:else}
	<EmbeddedRegisterModule onRegister={(response) => {
		loginData.email = response.email
		navigate("login")
	}} {navigate} />
{/if}