This commit is contained in:
2026-03-09 06:16:36 +01:00
parent ef54906d9a
commit 40dacc0b62
52 changed files with 1922 additions and 143 deletions
+31
View File
@@ -1,5 +1,8 @@
import Main from "@/src/components/pages/auth/login";
import Layout from "@/src/layouts/login";
import userAuth from "@/src/utils/user-auth";
import NSQLite from "@moduletrace/nsqlite";
import { GetServerSideProps } from "next";
export default function LoginPage() {
return (
@@ -8,3 +11,31 @@ export default function LoginPage() {
</Layout>
);
}
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const users = await NSQLite.select({ table: "users" });
if (!users.payload?.[0]) {
return {
redirect: {
destination: `/auth/signup`,
statusCode: 307,
},
};
}
const { singleRes: user } = await userAuth({ req: ctx.req });
if (user?.logged_in_status) {
return {
redirect: {
destination: `/admin`,
statusCode: 307,
},
};
}
return {
props: {},
};
};
+29
View File
@@ -0,0 +1,29 @@
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: {},
};
};