Skip to content

Commit 00756c8

Browse files
committed
Feat: 폴더 수정 모달 작업 중
1 parent bce0ff9 commit 00756c8

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

components/modal/EditModal.tsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,43 @@
1+
import { ChangeEvent, useState } from "react";
12
import ModalContainer from "./modalComponents/ModalContainer";
23
import ModalInput from "./modalComponents/ModalInput";
4+
import useModalStore from "@/store/useModalStore";
5+
import { putFolder } from "@/lib/api/folder";
36

47
const EditModal = ({ folderName }: { folderName: string }) => {
8+
const [value, setValue] = useState("");
9+
10+
const { closeModal } = useModalStore();
11+
12+
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
13+
setValue(e.target.value);
14+
};
15+
const handleSubmit = async () => {
16+
const body = {
17+
name: value,
18+
};
19+
// if (value !== "") {
20+
// try {
21+
// const res = await putFolder(folderId, body);
22+
// console.log(res);
23+
// } catch (error) {
24+
// console.log(error);
25+
// }
26+
// }
27+
closeModal();
28+
};
529
return (
6-
<ModalContainer title="폴더 이름 변경" buttonText="변경하기">
7-
<ModalInput placeholder="내용 입력" name={folderName} />
30+
<ModalContainer
31+
title="폴더 이름 변경"
32+
buttonText="변경하기"
33+
onClick={handleSubmit}
34+
>
35+
<ModalInput
36+
placeholder="내용 입력"
37+
name={folderName}
38+
value={value}
39+
onChange={handleChange}
40+
/>
841
</ModalContainer>
942
);
1043
};

0 commit comments

Comments
 (0)