refactor: migrate authentication to NextAuth and clean up related services
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { AuthService, userService, TeamsService } from "@/services";
|
||||
import { auth } from "@/auth";
|
||||
import { userService, TeamsService } from "@/services";
|
||||
import { AccountForm } from "@/components/account/account-form";
|
||||
|
||||
export default async function AccountPage() {
|
||||
try {
|
||||
// Vérifier si l'utilisateur est connecté
|
||||
const userUuid = await AuthService.getUserUuidFromCookie();
|
||||
const session = await auth();
|
||||
|
||||
if (!userUuid) {
|
||||
if (!session?.user) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
// Récupérer le profil utilisateur
|
||||
const userProfile = await userService.getUserByUuid(userUuid);
|
||||
const userProfile = await userService.getUserByUuid(session.user.id);
|
||||
|
||||
if (!userProfile) {
|
||||
redirect("/login");
|
||||
|
||||
Reference in New Issue
Block a user