Skip to content

Commit

Permalink
Merge pull request #212 from Team-Lecue/Hotfix-Rooming
Browse files Browse the repository at this point in the history
Merge Hotfix rooming into develop
  • Loading branch information
Arooming authored Jan 19, 2024
2 parents c736182 + dbc321a commit 2e19d62
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="./src/assets/favicon.svg" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=0"
/>

<meta property="og:title" content="레큐 lecue" />
<meta
property="og:description"
content="레큐노트에 우리의 마음을 담아 전달해요"
/>
<meta
property="og:image"
content="https://dzfv99wxq6tx0.cloudfront.net/lecue.png"
/>

<title>Lecue</title>
</head>
Expand Down
12 changes: 3 additions & 9 deletions src/LecueNote/components/ShowColorChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef } from 'react';
import { useRef } from 'react';

import { IcCameraSmall } from '../../../assets';
import { BG_COLOR_CHART } from '../../constants/colorChart';
Expand All @@ -19,7 +19,8 @@ function ShowColorChart({
handleIconFn,
}: ShowColorChartProps) {
const imgRef = useRef<HTMLInputElement | null>(null);
const { data } = useGetPresignedUrl();
// 여기
useGetPresignedUrl(setPresignedUrl, setFileName);

const handleImageUpload = () => {
const fileInput = imgRef.current;
Expand All @@ -44,13 +45,6 @@ function ShowColorChart({
}
};

useEffect(() => {
if (data !== undefined) {
setPresignedUrl(data.data.url);
setFileName(data.data.fileName);
}
}, [data]);

return (
<S.Wrapper>
{colorChart === BG_COLOR_CHART && (
Expand Down
9 changes: 8 additions & 1 deletion src/LecueNote/hooks/useGetPresignedUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ import { useNavigate } from 'react-router-dom';

import getPresignedUrl from '../api/getPresignedUrl';

const useGetPresignedUrl = () => {
const useGetPresignedUrl = (
setPresignedUrl: React.Dispatch<React.SetStateAction<string>>,
setFileName: React.Dispatch<React.SetStateAction<string>>,
) => {
const navigate = useNavigate();

const { isLoading, data } = useQuery({
queryKey: ['get-presigned-url'],
queryFn: () => getPresignedUrl(),
onError: () => navigate('/error'),
onSuccess: (data) => {
setPresignedUrl(data.data.url);
setFileName(data.data.fileName);
},
refetchOnWindowFocus: false,
});

Expand Down

0 comments on commit 2e19d62

Please sign in to comment.