refactor: integrate EvaluationClient and remove legacy evaluation actions
- Added EvaluationClient to clients/index.ts and created an instance for use. - Updated client-wrapper.tsx and welcome-screen.tsx to utilize EvaluationClient for evaluation actions. - Removed obsolete evaluation-actions.ts file to streamline codebase and reduce redundancy.
This commit is contained in:
@@ -9,13 +9,14 @@ import {
|
||||
UserProfile,
|
||||
CategoryEvaluation,
|
||||
} from "@/lib/types";
|
||||
import {
|
||||
updateSkillLevel as updateSkillLevelAction,
|
||||
updateSkillMentorStatus as updateSkillMentorStatusAction,
|
||||
updateSkillLearningStatus as updateSkillLearningStatusAction,
|
||||
addSkillToEvaluation as addSkillToEvaluationAction,
|
||||
removeSkillFromEvaluation as removeSkillFromEvaluationAction,
|
||||
} from "@/lib/evaluation-actions";
|
||||
import { evaluationClient } from "@/clients";
|
||||
const {
|
||||
updateSkillLevel: updateSkillLevelAction,
|
||||
updateSkillMentorStatus: updateSkillMentorStatusAction,
|
||||
updateSkillLearningStatus: updateSkillLearningStatusAction,
|
||||
addSkillToEvaluation: addSkillToEvaluationAction,
|
||||
removeSkillFromEvaluation: removeSkillFromEvaluationAction,
|
||||
} = evaluationClient;
|
||||
import { createEmptyEvaluation } from "@/lib/evaluation-utils";
|
||||
|
||||
interface EvaluationClientWrapperProps {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ProfileForm } from "@/components/profile-form";
|
||||
import { initializeEmptyEvaluation } from "@/lib/evaluation-actions";
|
||||
import { evaluationClient } from "@/clients";
|
||||
import { Team, UserProfile } from "@/lib/types";
|
||||
import { Code2 } from "lucide-react";
|
||||
|
||||
@@ -20,7 +20,7 @@ export function WelcomeEvaluationScreen({
|
||||
const handleProfileSubmit = async (profile: UserProfile) => {
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
await initializeEmptyEvaluation(profile);
|
||||
await evaluationClient.initializeEmptyEvaluation(profile);
|
||||
// Rafraîchir la page pour que le SSR prenne en compte la nouvelle évaluation
|
||||
router.refresh();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user