import Main from "@/src/components/pages/auth/signup";
import Layout from "@/src/layouts/login";
import NSQLite from "@moduletrace/nsqlite";
import { GetServerSideProps } from "next";

export default function LoginPage() {
    return (
        <Layout>
            <Main />
        </Layout>
    );
}

export const getServerSideProps: GetServerSideProps = async (ctx) => {
    const users = await NSQLite.select({ table: "users" });

    if (users.payload?.[0]) {
        return {
            redirect: {
                destination: `/auth/login`,
                statusCode: 307,
            },
        };
    }

    return {
        props: {},
    };
};
