fix: refresh list after creating key

This commit is contained in:
jialin
2026-06-03 15:50:06 +08:00
committed by jialin
parent 12f0bb2f98
commit 9f7a99f370
2 changed files with 11 additions and 9 deletions
@@ -98,10 +98,11 @@ const AddModal: React.FC<AddModalProps> = ({
expires_in: getExpireValue(data.expires_in) expires_in: getExpireValue(data.expires_in)
}; };
const res = await createApisKey({ data: params }); const res = await createApisKey({ data: params });
onOk();
// if custom value // if custom value
if (data.custom) { if (data.custom) {
return onOk(); onCancel();
return;
} }
setAPIKeyValue(res.value); setAPIKeyValue(res.value);
@@ -111,6 +112,7 @@ const AddModal: React.FC<AddModalProps> = ({
const updateAPIKey = async (data: FormData) => { const updateAPIKey = async (data: FormData) => {
await updateApisKey(currentData?.id as number, { data }); await updateApisKey(currentData?.id as number, { data });
onOk(); onOk();
onCancel();
}; };
const handleOnOk = async (formdata: FormData) => { const handleOnOk = async (formdata: FormData) => {
@@ -142,7 +144,7 @@ const AddModal: React.FC<AddModalProps> = ({
}; };
const handleDone = () => { const handleDone = () => {
onOk(); onCancel();
}; };
const handleAfterOpenChange = (isOpen: boolean) => { const handleAfterOpenChange = (isOpen: boolean) => {
+6 -6
View File
@@ -126,12 +126,12 @@ const APIKeys: React.FC = () => {
const handleModalOk = async () => { const handleModalOk = async () => {
try { try {
await fetchData(); await fetchData();
setOpenAddModal({ // setOpenAddModal({
open: false, // open: false,
title: '', // title: '',
action: PageAction.CREATE, // action: PageAction.CREATE,
currentData: null // currentData: null
}); // });
} catch (error) { } catch (error) {
// do nothing // do nothing
} }