mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Check if user exists on login
This commit is contained in:
18
app/page.tsx
18
app/page.tsx
@@ -1,7 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
|
||||
import {useEffect} from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import axios from "axios";
|
||||
|
||||
export default function LoginPage() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
const response = await axios.get("/api/user/init");
|
||||
if (response.data.message === "No users found") {
|
||||
router.push("/setup");
|
||||
}
|
||||
};
|
||||
init();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col lg:flex-row">
|
||||
<div className="flex-1 flex items-center justify-center p-6 lg:p-10">
|
||||
|
||||
Reference in New Issue
Block a user