Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Nov 17, 2024
1 parent f522f7a commit 051ef89
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
19 changes: 17 additions & 2 deletions hooks/custom/CustomHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useCallback, useEffect, useState } from "react";
import { useQueryClient } from "react-query";
import { useSetRecoilState } from "recoil";

import { GROUP_STUDY, STUDY_VOTE, USER_INFO } from "../../constants/keys/queryKeys";
import { GATHER_CONTENT, GROUP_STUDY, STUDY_VOTE, USER_INFO } from "../../constants/keys/queryKeys";
import { myStudyParticipationState } from "../../recoils/studyRecoils";
import { transferGroupDataState } from "../../recoils/transferRecoils";
import { transferGatherDataState, transferGroupDataState } from "../../recoils/transferRecoils";
import { IStudyVotePlaces } from "../../types/models/studyTypes/studyInterActions";
import { useStudyPreferenceMutation } from "../study/mutations";
import { useToast } from "./CustomToast";
Expand Down Expand Up @@ -72,6 +72,21 @@ export const useResetGroupQuery = () => {

return refetchWithDelay;
};
export const useResetGatherQuery = () => {
const queryClient = useQueryClient();
const setTransferGatherData = useSetRecoilState(transferGatherDataState);

const refetchWithDelay = useCallback(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
() => {
queryClient.invalidateQueries({ queryKey: [GATHER_CONTENT], exact: false });
setTransferGatherData(null);
},
[queryClient],
);

return refetchWithDelay;
};
export const useTogglePlaceHeart = () => {
const queryClient = useQueryClient();
const toast = useToast();
Expand Down
2 changes: 2 additions & 0 deletions modals/gather/GatherWritingConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ function GatherWritingConfirmModal({ setIsModal, gatherData }: IGatherWritingCon
const resetQueryData = useResetQueryData();
const setGatherContent = useSetRecoilState(sharedGatherWritingState);



const { mutate } = useGatherWritingMutation("post", {
onSuccess() {
resetQueryData([GATHER_CONTENT]);
Expand Down
18 changes: 9 additions & 9 deletions pageTemplates/gather/detail/GatherHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Box, Flex } from "@chakra-ui/react";
import dayjs from "dayjs";
import { useSession } from "next-auth/react";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import { useSession } from "next-auth/react";
import { useState } from "react";
import styled from "styled-components";

Expand Down Expand Up @@ -42,14 +42,14 @@ function GatherHeader({ gatherData }: IGatherHeader) {
<IconWrapper onClick={() => setDrawerType("kakaoShare")}>
<i className="fa-light fa-share-nodes fa-lg" />
</IconWrapper>
{(gatherData.user as IUserSummary)._id === session?.user.id ||
(session?.user.uid === "2259633694" && (
<IconWrapper>
<Link href={`/gather/${gatherData.id}/setting`}>
<i className="fa-light fa-gear fa-lg" />
</Link>
</IconWrapper>
))}
{((gatherData.user as IUserSummary)._id === session?.user.id ||
session?.user.uid === "2259633694") && (
<IconWrapper>
<Link href={`/gather/${gatherData.id}/setting`}>
<i className="fa-light fa-gear fa-lg" />
</Link>
</IconWrapper>
)}
</Flex>
</Header>
{drawerType === "kakaoShare" && (
Expand Down

0 comments on commit 051ef89

Please sign in to comment.