diff --git a/app/LoginPage.tsx b/app/LoginPage.tsx
new file mode 100644
index 0000000..042e417
--- /dev/null
+++ b/app/LoginPage.tsx
@@ -0,0 +1,73 @@
+"use client";
+
+import Image from "next/image"
+import Link from "next/link"
+
+export default function LoginPage() {
+
+ return (
+
+
+
+
+
Welcome back
+
Please login with your account
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/app/page.tsx b/app/page.tsx
index 74641a5..9f42f1b 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,88 +1,31 @@
"use client";
-import Image from "next/image"
-import Link from "next/link"
+import LoginPage from "./LoginPage";
+import Loading from "@/components/Loading";
-import { useEffect } from "react";
+import { useState, useEffect } from "react";
import { useRouter } from "next/navigation";
import axios from "axios";
export default function Login() {
const router = useRouter();
+ const [loading, setLoading] = useState(true);
useEffect(() => {
const init = async () => {
const response = await axios.get("/api/user/init");
if (response.data.message === "No users found") {
router.push("/setup");
+ } else {
+ setLoading(false);
}
};
init();
}, []);
-
- return (
-
-
-
-
-
Welcome back
-
Please login with your account
-
-
-
-
-
-
-
-
-
-
-
- )
-}
+ if (loading) {
+ return ;
+ } else {
+ return ;
+ }
+}
\ No newline at end of file
diff --git a/components/Loading.tsx b/components/Loading.tsx
new file mode 100644
index 0000000..c2933c6
--- /dev/null
+++ b/components/Loading.tsx
@@ -0,0 +1,8 @@
+
+export default function Loading() {
+ return (
+
+
+
+ );
+}
\ No newline at end of file