58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
'use client'
|
|
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from "@/components/ui/card"
|
|
import { Button } from "@/components/ui/button"
|
|
|
|
import { useEffect } from "react"
|
|
import { useRouter } from 'next/navigation'
|
|
import { setCookie, getCookie } from "@/lib/utils"
|
|
|
|
export default function Signin() {
|
|
const router = useRouter()
|
|
|
|
useEffect(() => {
|
|
if(getCookie('JWT') == "") {
|
|
router.refresh()
|
|
router.push('/')
|
|
}
|
|
},[])
|
|
|
|
function disconnect(){
|
|
setCookie('JWT','',-1)
|
|
// INFO : We need to hard refresh for the NavigationBar to be updated
|
|
const base_url = window.location.origin
|
|
window.location.replace(base_url)
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<div className="flex flex-col items-center mt-24" >
|
|
<h1 className="text-3xl mb-4">Mon compte</h1>
|
|
<Card className="w-full max-w-xs">
|
|
<CardHeader>
|
|
<CardTitle>Administration</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="flex flex-col gap-4">
|
|
<a href="/admin/bsets" className="w-full"><Button className="w-auto">Éditer les BSets</Button></a>
|
|
<Button className="w-auto" disabled={true}>Éditer les cartes</Button>
|
|
<Button className="w-auto" disabled={true}>Éditer les joueur·euses</Button>
|
|
</CardContent>
|
|
</Card>
|
|
<Card className="w-full max-w-xs">
|
|
<CardHeader>
|
|
<CardTitle>Profile</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="flex flex-col gap-4">
|
|
<Button className="w-auto" disabled={true}>Changer mon mot de passe</Button>
|
|
<Button onClick={disconnect} className="w-auto">Deconnexion</Button>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|