Commit ba517b6a by Archer Committed by GitHub

fix: api key delete bug (#1524)

parent 2f93dedf
......@@ -41,23 +41,23 @@ export const useConfirm = (props?: {
const { isOpen, onOpen, onClose } = useDisclosure();
const confirmCb = useRef<any>();
const confirmCb = useRef<Function>();
const cancelCb = useRef<any>();
return {
openConfirm: useCallback(
(confirm?: any, cancel?: any, customContent?: string | React.ReactNode) => {
const openConfirm = (
confirm?: Function,
cancel?: any,
customContent?: string | React.ReactNode
) => {
confirmCb.current = confirm;
cancelCb.current = cancel;
customContent && setCustomContent(customContent);
return onOpen;
},
[onOpen]
),
onClose,
ConfirmModal: useCallback(
};
const ConfirmModal = useCallback(
({
closeText = t('common.Cancel'),
confirmText = t('common.Confirm'),
......@@ -122,6 +122,11 @@ export const useConfirm = (props?: {
);
},
[customContent, hideFooter, iconSrc, isOpen, map.bg, onClose, showCancel, t, title]
)
);
return {
openConfirm,
onClose,
ConfirmModal
};
};
......@@ -68,7 +68,9 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
});
const { mutate: onclickRemove, isLoading: isDeleting } = useMutation({
mutationFn: async (id: string) => delOpenApiById(id),
mutationFn: async (id: string) => {
return delOpenApiById(id);
},
onSuccess() {
refetch();
}
......@@ -212,7 +214,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
label: t('common.Delete'),
icon: 'delete',
type: 'danger',
onClick: openConfirm(() => onclickRemove(_id))
onClick: () => openConfirm(() => onclickRemove(_id))()
}
]}
/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment