From f6e0538b96709e40339970eeb32ef82b40563403 Mon Sep 17 00:00:00 2001 From: soojeong Date: Sat, 11 Mar 2023 19:25:52 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20axios=20=EC=84=B1=EA=B3=B5,=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=20=EC=8B=9C=EC=9D=98=20alert=20=EC=B6=94=EA=B0=80=20#?= =?UTF-8?q?5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RegisterEditor/index.tsx | 9 ++++++--- src/components/UpdateEditor/index.tsx | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/RegisterEditor/index.tsx b/src/components/RegisterEditor/index.tsx index 3ed06d8..efd17be 100644 --- a/src/components/RegisterEditor/index.tsx +++ b/src/components/RegisterEditor/index.tsx @@ -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 ( diff --git a/src/components/UpdateEditor/index.tsx b/src/components/UpdateEditor/index.tsx index d76f87f..882f56f 100644 --- a/src/components/UpdateEditor/index.tsx +++ b/src/components/UpdateEditor/index.tsx @@ -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("필진이 성공적으로 수정되었습니다."); }); } };