mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
fix: api key delete bug (#1524)
This commit is contained in:
@@ -41,23 +41,23 @@ export const useConfirm = (props?: {
|
|||||||
|
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
|
|
||||||
const confirmCb = useRef<any>();
|
const confirmCb = useRef<Function>();
|
||||||
const cancelCb = useRef<any>();
|
const cancelCb = useRef<any>();
|
||||||
|
|
||||||
return {
|
const openConfirm = (
|
||||||
openConfirm: useCallback(
|
confirm?: Function,
|
||||||
(confirm?: any, cancel?: any, customContent?: string | React.ReactNode) => {
|
cancel?: any,
|
||||||
|
customContent?: string | React.ReactNode
|
||||||
|
) => {
|
||||||
confirmCb.current = confirm;
|
confirmCb.current = confirm;
|
||||||
cancelCb.current = cancel;
|
cancelCb.current = cancel;
|
||||||
|
|
||||||
customContent && setCustomContent(customContent);
|
customContent && setCustomContent(customContent);
|
||||||
|
|
||||||
return onOpen;
|
return onOpen;
|
||||||
},
|
};
|
||||||
[onOpen]
|
|
||||||
),
|
const ConfirmModal = useCallback(
|
||||||
onClose,
|
|
||||||
ConfirmModal: useCallback(
|
|
||||||
({
|
({
|
||||||
closeText = t('common.Cancel'),
|
closeText = t('common.Cancel'),
|
||||||
confirmText = t('common.Confirm'),
|
confirmText = t('common.Confirm'),
|
||||||
@@ -122,6 +122,11 @@ export const useConfirm = (props?: {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
[customContent, hideFooter, iconSrc, isOpen, map.bg, onClose, showCancel, t, title]
|
[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({
|
const { mutate: onclickRemove, isLoading: isDeleting } = useMutation({
|
||||||
mutationFn: async (id: string) => delOpenApiById(id),
|
mutationFn: async (id: string) => {
|
||||||
|
return delOpenApiById(id);
|
||||||
|
},
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
refetch();
|
refetch();
|
||||||
}
|
}
|
||||||
@@ -212,7 +214,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
|||||||
label: t('common.Delete'),
|
label: t('common.Delete'),
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
onClick: openConfirm(() => onclickRemove(_id))
|
onClick: () => openConfirm(() => onclickRemove(_id))()
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user