Skip to content

Commit

Permalink
fix : 파일업로드 수정
Browse files Browse the repository at this point in the history
fix : 파일업로드 수정
  • Loading branch information
phyuna0525 authored May 2, 2024
2 parents 1ebb272 + 6b69680 commit e094694
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/BugReport/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const BugReport = () => {
content: "",
file_name: "",
});
let filename = "";
const [filename, setFilename] = useState<string>("");

const handleContent = ({ text, name }: { text: string; name: string }) => {
setData({ ...data, [name]: text });
Expand All @@ -34,7 +34,7 @@ const BugReport = () => {
{ file: selectedFile },
{
onSuccess: (data) => {
filename = data;
setFilename(data);
},
onError: (error) => {
alert(error.message);
Expand All @@ -47,6 +47,13 @@ const BugReport = () => {
}
};

useEffect(() => {
setData({
...data,
file_name: filename,
});
}, [filename]);

const Bug = async () => {
await BugPostMutate(data, {
onSuccess: () => {
Expand Down

0 comments on commit e094694

Please sign in to comment.