mirror of
http://88.130.71.182:3000/BlitTech/badoHair_fe.git
synced 2026-06-13 08:58:31 +00:00
changes after second dev test
fixed full name issue, refresh issue on reservation and user/admin login issue
This commit is contained in:
@@ -12,7 +12,7 @@ import { toast } from "sonner";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function AdminLogin() {
|
||||
const { login } = useAuth();
|
||||
const { login, logout } = useAuth();
|
||||
const router = useRouter();
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
@@ -24,6 +24,7 @@ export default function AdminLogin() {
|
||||
try {
|
||||
const profile = await login(email, password);
|
||||
if (profile.role !== "admin") {
|
||||
logout();
|
||||
toast.error("Accès refusé : rôle administrateur requis");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user