Skip to content

Commit

Permalink
feat: axios 성공,실패 시의 alert 추가 #5
Browse files Browse the repository at this point in the history
  • Loading branch information
sooje0ng committed Mar 11, 2023
1 parent f288397 commit f6e0538
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/components/RegisterEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ const RegisterEditor = () => {
new Blob([newEditorString], { type: "application/json" })
);

await EditorAPI.postRegisterEditor(formData);
await EditorAPI.postRegisterEditor(formData).then((res) => {
if (res) {
alert("필진이 성공적으로 등록되었습니다.");
resetData();
} else alert("필진 등록을 실패했습니다.");
});
}
alert("필진이 성공적으로 등록되었습니다.");
resetData();
};

return (
Expand Down
7 changes: 5 additions & 2 deletions src/components/UpdateEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ const UpdateEditor = () => {
"data",
new Blob([newEditorString], { type: "application/json" })
);
await EditorAPI.updateEditor(formData);
await EditorAPI.updateEditor(formData).then((res) => {
if (res) {
alert("필진이 성공적으로 수정되었습니다.");
} else alert("필진 수정을 실패했습니다.");
});
setEditor(newEditor);
await EditorAPI.getEditorAll().then((data) => {
setEditors(data);
alert("필진이 성공적으로 수정되었습니다.");
});
}
};
Expand Down

0 comments on commit f6e0538

Please sign in to comment.