refactor: revew all design of services, clients, deadcode, ...
This commit is contained in:
22
app/page.tsx
22
app/page.tsx
@@ -1,10 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import {
|
||||
isUserAuthenticated,
|
||||
getServerUserEvaluation,
|
||||
getServerSkillCategories,
|
||||
getServerTeams,
|
||||
} from "@/lib/server-auth";
|
||||
import { AuthService } from "@/services";
|
||||
import { evaluationService, SkillsService, TeamsService } from "@/services";
|
||||
import { generateRadarData } from "@/lib/evaluation-utils";
|
||||
import {
|
||||
WelcomeHeader,
|
||||
@@ -16,19 +12,17 @@ import {
|
||||
} from "@/components/home";
|
||||
|
||||
export default async function HomePage() {
|
||||
// Vérifier l'authentification
|
||||
const isAuthenticated = await isUserAuthenticated();
|
||||
// Charger les données côté serveur
|
||||
const userUuid = await AuthService.getUserUuidFromCookie();
|
||||
|
||||
// Si pas de cookie d'authentification, rediriger vers login
|
||||
if (!isAuthenticated) {
|
||||
if (!userUuid) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
// Charger les données côté serveur
|
||||
const [userEvaluation, skillCategories, teams] = await Promise.all([
|
||||
getServerUserEvaluation(),
|
||||
getServerSkillCategories(),
|
||||
getServerTeams(),
|
||||
evaluationService.getServerUserEvaluation(userUuid!),
|
||||
SkillsService.getSkillCategories(),
|
||||
TeamsService.getTeams(),
|
||||
]);
|
||||
|
||||
// Si pas d'évaluation, afficher l'écran d'accueil
|
||||
|
||||
Reference in New Issue
Block a user