import { useNavigate } from "@solidjs/router";
import { createSignal, createEffect, type Component, onMount } from "solid-js";
import { dispatch, state } from "../../store/state";
import { AuthActionTypes } from "../../store/auth";

const RegisterView: Component = () => {
    const [getUsername, setUsername] = createSignal("");
    const [getEmail, setEmail] = createSignal("");
    const [getPassword, setPassword] = createSignal("");

    const navigate = useNavigate();

    onMount(() => {
        dispatch({
            type: AuthActionTypes.FETCH_REFRESH_START,
        });
    });

    createEffect(() => {
        if (state.auth.loggedIn) {
            navigate("/app");
        }
    });

    return <div></div>;
};

export { RegisterView };
