Skip to content

Commit

Permalink
fix: 내 식물 편집 페이지 이미지 리스트 + 버튼 클릭시 피드 페이지로 이동 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
gihwan-dev committed Oct 8, 2024
1 parent 5644c54 commit b16591a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/myPlantEdit/ImageInputWithList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useId } from 'react';
import CameraIcon from '@/assets/icon/camera-gray.svg?react';
import { parseIdParams } from '@/utils/params/parseIdParams.ts';
import { useHandleImage } from '@/hooks/useHandleImage.ts';
import { Link } from 'react-router-dom';

interface ImageInputWithListProps {
images: {
Expand Down Expand Up @@ -70,7 +71,7 @@ const ImageInputWithList = ({ images, plantId }: ImageInputWithListProps) => {
/>
))}
{images.length > 2 && (
<div className={'w-16 aspect-square relative'}>
<Link to={`/my-plant/${plantId}/feed`} className={'w-16 aspect-square relative'}>
<img
src={images[2].imageUrl}
className={'w-16 aspect-square rounded-[10px]'}
Expand All @@ -86,7 +87,7 @@ const ImageInputWithList = ({ images, plantId }: ImageInputWithListProps) => {
>
+ {images.slice(3).length}
</div>
</div>
</Link>
)}
</ul>
);
Expand Down
7 changes: 7 additions & 0 deletions src/pages/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { useToken } from '@/hooks/useToken.ts';
import { SECOND } from '@/constants/day.ts';
import { useQueryClient } from '@tanstack/react-query';
import { keyStore } from '@/queries/keyStore.ts';
import { getMyAllPlant } from '@/apis/myPlant/getMyAllPlant.ts';
import { getAllLocation } from '@/apis/location/getAllLocation.ts';

const Main = () => {
const { data: homeData } = useGetHomeData();
Expand Down Expand Up @@ -52,6 +54,11 @@ const Main = () => {
useEffect(() => {
void queryClient.prefetchQuery({
queryKey: keyStore.myPlant.getMyAllPlant.queryKey,
queryFn: getMyAllPlant,
});
void queryClient.prefetchQuery({
queryKey: keyStore.location.getAllLocation.queryKey,
queryFn: getAllLocation,
});
}, []);

Expand Down

0 comments on commit b16591a

Please sign in to comment.