From 68fe230ed98846e43b3eff4407f284c63eabad36 Mon Sep 17 00:00:00 2001 From: "K.Chanatipz" Date: Mon, 19 Feb 2024 11:02:40 +0700 Subject: [PATCH] fix: lint --- src/api/pets.ts | 9 ++++++--- src/components/Card/PetCard/index.tsx | 8 +++++--- src/hooks/mutation/useUpdateVisibility.ts | 13 +++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/api/pets.ts b/src/api/pets.ts index a21584e2..cd72a39c 100644 --- a/src/api/pets.ts +++ b/src/api/pets.ts @@ -37,13 +37,16 @@ const postPet = async (data: postPetRequest): Promise => { return response.data; }; -const updateVisibility = async (id: string, visibility: boolean): Promise => { +const updateVisibility = async ( + id: string, + visibility: boolean +): Promise => { const { accessToken } = useAuthStore.getState(); const response = await axios.put( `${import.meta.env.VITE_API_URL}/pets/${id}`, { - is_visible: visibility + is_visible: visibility, }, { headers: { @@ -53,7 +56,7 @@ const updateVisibility = async (id: string, visibility: boolean): Promise = ); return response.data; -} +}; export { getPets, postPet, updateVisibility }; export type { PetsResponse, postPetRequest }; diff --git a/src/components/Card/PetCard/index.tsx b/src/components/Card/PetCard/index.tsx index ce00588e..4d65ee6d 100644 --- a/src/components/Card/PetCard/index.tsx +++ b/src/components/Card/PetCard/index.tsx @@ -26,7 +26,6 @@ const handleClick = (event: React.MouseEvent) => { event.stopPropagation(); }; - const likeHandle = (event: React.MouseEvent) => { handleClick(event); }; @@ -50,7 +49,7 @@ const PetCard = ({ const [visibility, setVisibility] = useState(isVisibled); const toggleVisibility = () => { setVisibility((prev) => !prev); - } + }; const pathname = useLocation().pathname; const role = useMemo(() => { @@ -128,7 +127,10 @@ const PetCard = ({ onClick={adoptHandle} /> ) : ( - + )} diff --git a/src/hooks/mutation/useUpdateVisibility.ts b/src/hooks/mutation/useUpdateVisibility.ts index 5291b17f..91ad7ce3 100644 --- a/src/hooks/mutation/useUpdateVisibility.ts +++ b/src/hooks/mutation/useUpdateVisibility.ts @@ -1,10 +1,11 @@ -import {updateVisibility} from "@/api/pets"; +import { updateVisibility } from "@/api/pets"; import { useMutation } from "@tanstack/react-query"; const useUpdateVisibility = () => { - return useMutation({ - mutationFn: ({ id, visibility }: { id: string, visibility: boolean }) => updateVisibility(id, visibility) - }); -} + return useMutation({ + mutationFn: ({ id, visibility }: { id: string; visibility: boolean }) => + updateVisibility(id, visibility), + }); +}; -export { useUpdateVisibility }; \ No newline at end of file +export { useUpdateVisibility };