Skip to content

Commit

Permalink
Merge pull request #113 from gw-lim/hotfix/like
Browse files Browse the repository at this point in the history
⚡️ hotfix: 좋아요 기본 유저 값 수정
  • Loading branch information
gw-lim authored Feb 19, 2024
2 parents d006b3d + 1f562ea commit 531bcde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/_hooks/useLikeEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { instance } from "@/api/api";
import { useSession } from "@/store/session/cookies";
import { Res_Get_Type } from "@/types/getResType";

const DEFAULT_USER_ID = "default";
const QUERY_KEY = "like";

interface Props {
Expand All @@ -17,7 +16,7 @@ const useLikeEvent = ({ eventId, initialLikeCount }: Props) => {
const queryClient = useQueryClient();
const router = useRouter();

const userId = session?.user.userId ?? DEFAULT_USER_ID;
const userId = session?.user.userId ?? "";

const { data: likeData } = useQuery<Res_Get_Type["eventLike"]>({
queryKey: [QUERY_KEY, eventId, userId],
Expand Down Expand Up @@ -53,6 +52,7 @@ const useLikeEvent = ({ eventId, initialLikeCount }: Props) => {
const handleLikeEvent = () => {
if (!session) {
router.push("/signin");
return;
}
likeMutation.mutate();
};
Expand Down

0 comments on commit 531bcde

Please sign in to comment.