Skip to content

Commit

Permalink
fix projecDetails: empty comments post validation
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Mar 15, 2024
1 parent 4d85883 commit f706494
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/frontend/src/components/ProjectDetailsV2/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useAppSelector } from '@/types/reduxTypes';
import AssetModules from '@/shared/AssetModules';
import { ProjectCommentsSekeletonLoader } from '@/components/ProjectDetailsV2/SkeletonLoader';
import { ProjectActions } from '@/store/slices/ProjectSlice';
import { CommonActions } from '@/store/slices/CommonSlice';

const Comments = () => {
const dispatch = useDispatch();
Expand All @@ -27,6 +28,17 @@ const Comments = () => {
}, []);

const handleComment = () => {
if (!comment) {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: 'Empty comment field.',
variant: 'error',
duration: 2000,
}),
);
return;
}
dispatch(
PostProjectComments(`${import.meta.env.VITE_API_URL}/tasks/task-comments/`, {
task_id: 3968,
Expand Down

0 comments on commit f706494

Please sign in to comment.