fix: refresh list after creating key
This commit is contained in:
@@ -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) => {
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user