From 9f7a99f370f1010c8278e60e9a6f164b40ed0b19 Mon Sep 17 00:00:00 2001 From: jialin Date: Wed, 3 Jun 2026 13:38:28 +0800 Subject: [PATCH] fix: refresh list after creating key --- .../api-keys/components/add-apikey-modal/index.tsx | 8 +++++--- src/pages/api-keys/index.tsx | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/pages/api-keys/components/add-apikey-modal/index.tsx b/src/pages/api-keys/components/add-apikey-modal/index.tsx index f6e178e8..8238bcf3 100644 --- a/src/pages/api-keys/components/add-apikey-modal/index.tsx +++ b/src/pages/api-keys/components/add-apikey-modal/index.tsx @@ -98,10 +98,11 @@ const AddModal: React.FC = ({ expires_in: getExpireValue(data.expires_in) }; const res = await createApisKey({ data: params }); - + onOk(); // if custom value if (data.custom) { - return onOk(); + onCancel(); + return; } setAPIKeyValue(res.value); @@ -111,6 +112,7 @@ const AddModal: React.FC = ({ const updateAPIKey = async (data: FormData) => { await updateApisKey(currentData?.id as number, { data }); onOk(); + onCancel(); }; const handleOnOk = async (formdata: FormData) => { @@ -142,7 +144,7 @@ const AddModal: React.FC = ({ }; const handleDone = () => { - onOk(); + onCancel(); }; const handleAfterOpenChange = (isOpen: boolean) => { diff --git a/src/pages/api-keys/index.tsx b/src/pages/api-keys/index.tsx index 0e3e923c..cd740ec7 100644 --- a/src/pages/api-keys/index.tsx +++ b/src/pages/api-keys/index.tsx @@ -126,12 +126,12 @@ const APIKeys: React.FC = () => { const handleModalOk = async () => { try { await fetchData(); - setOpenAddModal({ - open: false, - title: '', - action: PageAction.CREATE, - currentData: null - }); + // setOpenAddModal({ + // open: false, + // title: '', + // action: PageAction.CREATE, + // currentData: null + // }); } catch (error) { // do nothing }