Skip to content

Commit

Permalink
fix:수정기능-수정
Browse files Browse the repository at this point in the history
  • Loading branch information
candosh committed Dec 19, 2023
1 parent ac6ae77 commit cd41510
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 32 deletions.
3 changes: 0 additions & 3 deletions src/components/CompleteWriting/AAR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function CompleteWritingARR({ isEditMode }: isEditModeTypeProps) {
const [retrospectiveData, setRetrospectiveData] = useState<DataType | null>(
null
);
const [editMode, setIsEditMode] = useState(false);

useEffect(() => {
const fetchData = async () => {
Expand Down Expand Up @@ -79,15 +78,13 @@ function CompleteWritingARR({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (
Expand Down
8 changes: 4 additions & 4 deletions src/components/CompleteWriting/Continue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function CompleteWritingContinue({ isEditMode }: isEditModeTypeProps) {
const [retrospectiveData, setRetrospectiveData] = useState<DataType | null>(
null
);
const [editMode, setIsEditMode] = useState(false);

useEffect(() => {
const fetchData = async () => {
Expand Down Expand Up @@ -77,18 +76,19 @@ function CompleteWritingContinue({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
8 changes: 4 additions & 4 deletions src/components/CompleteWriting/FiveF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function CompleteWritingFiveF({ isEditMode }: isEditModeTypeProps) {
const [retrospectiveData, setRetrospectiveData] = useState<DataType | null>(
null
);
const [isEditMode, setIsEditMode] = useState(false);

useEffect(() => {
const fetchData = async () => {
Expand Down Expand Up @@ -87,18 +86,19 @@ function CompleteWritingFiveF({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
7 changes: 4 additions & 3 deletions src/components/CompleteWriting/FourL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@ function CompleteWritingFourL({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
9 changes: 6 additions & 3 deletions src/components/CompleteWriting/KPT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ function CompleteWritingKPT({ isEditMode }: isEditModeTypeProps) {
null
);

const [editMode, setIsEditMode] = useState(false);

useEffect(() => {
const fetchData = async () => {
try {
Expand Down Expand Up @@ -76,18 +78,19 @@ function CompleteWritingKPT({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
7 changes: 4 additions & 3 deletions src/components/CompleteWriting/ORID.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@ function CompleteWritingORID({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
7 changes: 4 additions & 3 deletions src/components/CompleteWriting/Performance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,19 @@ function CompleteWritingPerfomance({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
7 changes: 4 additions & 3 deletions src/components/CompleteWriting/Personal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,19 @@ function CompleteWritingPersonal({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
7 changes: 4 additions & 3 deletions src/components/CompleteWriting/TIL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,19 @@ function CompleteWritingTIL({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down
7 changes: 4 additions & 3 deletions src/components/CompleteWriting/YWT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,19 @@ function CompleteWritingYWT({ isEditMode }: isEditModeTypeProps) {
console.log("수정 요청 성공:", response.data);
alert("수정이 완료되었습니다!🥳");
window.location.reload();
setIsEditMode(false);
} catch (error) {
console.error("수정 요청 실패:", error);
}
};

const handleCancel = () => {
window.location.reload();
setIsEditMode(false);
};

const renderContentInput = (content, setContent) => {
const renderContentInput = (
content: string,
setContent: React.Dispatch<React.SetStateAction<string>>
) => {
return isEditMode ? (
<textarea
className="mainContent_Input"
Expand Down

0 comments on commit cd41510

Please sign in to comment.