feat: enhance project and mentor management features
- Updated MentorProjectCard to provide more detailed success/error messages upon archiving and completing projects. - Adjusted layout for certificate generation to improve visual alignment. - Introduced resolveErrorMessage utility to standardize error message handling across the application. - Enhanced customToast functionality to handle hook failures more gracefully. - Refactored useCertificates hook to return structured responses for certificate claims and generation. - Updated useMentors hook to improve error handling and response structure for mentor operations. - Improved useNotification hook to return structured responses for marking notifications as read. - Refactored useProjects hook to provide structured responses for project creation, updates, and member assignments. - Enhanced useTasks hook to return structured responses for task creation, updates, and deletions. - Updated services to return structured responses with messages for various API calls related to certificates, mentors, notifications, projects, tasks, and user management. - Moved mentor-related types to a dedicated user.types file for better organization.
This commit is contained in:
@@ -3,6 +3,7 @@ import { X } from "lucide-react";
|
||||
import { LuSave } from "react-icons/lu";
|
||||
import { useUpdateTask } from "../../../../hooks/useTasks";
|
||||
import type { ProjectTask, SubmissionType, UpdateTaskPayload } from "../../../../types/task.types";
|
||||
import { customToast } from "../../../utils/showToast";
|
||||
|
||||
interface EditTaskModalProps {
|
||||
isOpen: boolean;
|
||||
@@ -79,9 +80,12 @@ export default function EditSubmissionModal({
|
||||
return;
|
||||
}
|
||||
const result = await update(task.id, payload, String(task.id_project));
|
||||
if (result) {
|
||||
onSuccess(result);
|
||||
if (result.data) {
|
||||
customToast.success("Task diperbarui", result.message);
|
||||
onSuccess(result.data);
|
||||
onClose();
|
||||
} else {
|
||||
customToast.error("Gagal", result.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user