mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Setup UI
This commit is contained in:
@@ -1,26 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import SetupPage from "./SetupPage";
|
||||
import Loading from "@/components/Loading";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import axios from "axios";
|
||||
|
||||
export default function Setup() {
|
||||
const router = useRouter();
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
export default function SetupPage() {
|
||||
const router = useRouter();
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
const response = await axios.get("/api/user/init");
|
||||
if (response.data.message !== "No users found") {
|
||||
router.push("/");
|
||||
} else {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
init();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
const response = await axios.get("/api/user/init");
|
||||
if (response.data.message !== "No users found") {
|
||||
router.push("/");
|
||||
}
|
||||
};
|
||||
init();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Setup</h1>
|
||||
</div>
|
||||
);
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
} else {
|
||||
return <SetupPage />;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user