Skip to content

Commit

Permalink
perf: study minimum vote hour
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Sep 6, 2024
1 parent cefcb69 commit b66c33a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions components/services/studyVote/MapBottomNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ function MapBottomNav({ morePlaces, myVote, voteScore, setMyVote }: IMapBottomNa
};

const onSubmit = () => {
const diffHour = voteTime.end.diff(voteTime.start, "hour");
if (diffHour < 2) {
toast("warning", "최소 2시간은 선택되어야 합니다.");
return;
}
studyVote({
...myVote,
...voteTime,
Expand Down
7 changes: 6 additions & 1 deletion components/services/studyVote/StudyVoteDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from "dayjs";
import { useParams } from "next/navigation";
import { useSession } from "next-auth/react";
import { useParams } from "next/navigation";
import { useEffect, useState } from "react";
import { useQueryClient } from "react-query";
import { useRecoilValue } from "recoil";
Expand Down Expand Up @@ -94,6 +94,11 @@ export default function StudyVoteDrawer({ setIsModal }: IStudyVoteDrawer) {
};

const onSubmit = () => {
const diffHour = voteTime.end.diff(voteTime.start, "hour");
if (diffHour < 2) {
toast("warning", "최소 2시간은 선택되어야 합니다.");
return;
}
const temp = {
...myVote,
place: myVote.place,
Expand Down
8 changes: 7 additions & 1 deletion pageTemplates/vote/VoteTimeDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { IBottomDrawerLgOptions } from "../../components/organisms/drawer/Bottom
import StudyVoteTimeRulletDrawer from "../../components/services/studyVote/StudyVoteTimeRulletDrawer";
import { STUDY_VOTE, STUDY_VOTE_CNT } from "../../constants/keys/queryKeys";
import {
POINT_SYSTEM_PLUS,
PointSystemProp,
POINT_SYSTEM_PLUS,
} from "../../constants/serviceConstants/pointSystemConstants";
import { useToast } from "../../hooks/custom/CustomToast";
import { useStudyParticipationMutation } from "../../hooks/study/mutations";
Expand Down Expand Up @@ -108,6 +108,12 @@ function VoteTimeDrawer({ myVote, voterCnt, actionType, setActionType }: IVoteTi
};

const onSubmit = () => {
const diffHour = voteTime.end.diff(voteTime.start, "hour");

if (diffHour < 2) {
toast("warning", "최소 2시간은 선택되어야 합니다.");
return;
}
studyVote({
...myVote,
...voteTime,
Expand Down

0 comments on commit b66c33a

Please sign in to comment.