fix: atflCd 쿠키 초기화 로직 추가

This commit is contained in:
2025-04-08 16:28:27 +09:00
parent 07ee7adca5
commit 2eb9eb9370
3 changed files with 6 additions and 6 deletions
@@ -64,8 +64,6 @@ const BannerImage = ({ atflCd }: { atflCd: string }) => {
const [imageUrl, setImageUrl] = useState("");
useEffect(() => {
if (!atflCd) return;
(async () => {
setImageUrl(await AttachmentApi.getImageUrlByAtflCd(atflCd));
})();
+3 -1
View File
@@ -19,13 +19,14 @@ import {
TableRow,
Textarea,
} from "@common/components";
import { FormWrapper } from "@/widgets/form-wrapper";
import { CodeSelect } from "@/entities/code";
import { AttachmentApi } from "@/entities/attachment";
import { ENDPOINT } from "@/shared/config";
import { setCookie } from "@/shared/lib/cookie";
import { FormControl, FormField, FormItem } from "@/shared/ui/form";
import type { BannerFormData } from "../model/banner-interface";
import { handleUpload } from "../lib/utils";
import { FormWrapper } from "@/widgets/form-wrapper";
type BannerFormProps = {
form: UseFormReturn<BannerFormData>;
@@ -138,6 +139,7 @@ function BannerForm({ form, bnrSn, ...props }: BannerFormProps) {
onUpload={(e) => {
const files = e.target.files;
if (!files) return;
setCookie("atfl-cd-key", "");
handleUpload(files, {
handleUploadStart: setUpload,
handleProgress,
+3 -3
View File
@@ -22,6 +22,7 @@ import { FormWrapper } from "@/widgets/form-wrapper";
import { CodeSelect } from "@/entities/code";
import { AttachmentApi } from "@/entities/attachment";
import { ENDPOINT } from "@/shared/config";
import { setCookie } from "@/shared/lib/cookie";
import { FormControl, FormField, FormItem } from "@/shared/ui/form";
import type { ImageFormData } from "../model/image-interface";
import { handleUpload } from "../lib/utils";
@@ -64,11 +65,9 @@ function ImageForm({ form, imgSn, ...props }: ImageFormProps) {
};
useEffect(() => {
if (!attachmentData) return;
(async () => {
setImageUrl(
await AttachmentApi.getImageUrlByAtflCd(attachmentData.atflCd),
await AttachmentApi.getImageUrlByAtflCd(attachmentData?.atflCd ?? ""),
);
})();
}, [attachmentData]);
@@ -198,6 +197,7 @@ function ImageForm({ form, imgSn, ...props }: ImageFormProps) {
onUpload={(e) => {
const files = e.target.files;
if (!files) return;
setCookie("atfl-cd-key", "");
handleUpload(files, {
handleUploadStart: setUpload,
handleProgress,