fix(striker-ui): add loading setter to confirm dialog hook

main
Tsu-ba-me 11 months ago
parent 3dcc2ba0c5
commit 4d65472694
  1. 11
      striker-ui/hooks/useConfirmDialog.tsx

@ -20,6 +20,7 @@ const useConfirmDialog = (
): {
confirmDialog: ReactElement;
confirmDialogRef: MutableRefObject<ConfirmDialogForwardedRefContent | null>;
setConfirmDialogLoading: (value: boolean) => void;
setConfirmDialogOpen: (value: boolean) => void;
setConfirmDialogProps: Dispatch<SetStateAction<ConfirmDialogProps>>;
finishConfirm: (title: ReactNode, message: Message) => void;
@ -44,6 +45,15 @@ const useConfirmDialog = (
titleText,
});
const setConfirmDialogLoading = useCallback(
(value: boolean) =>
setConfirmDialogProps(({ loading, ...rest }) => ({
...rest,
loading: value,
})),
[],
);
const setConfirmDialogOpen = useCallback(
(value: boolean) => confirmDialogRef?.current?.setOpen?.call(null, value),
[],
@ -75,6 +85,7 @@ const useConfirmDialog = (
return {
confirmDialog,
confirmDialogRef,
setConfirmDialogLoading,
setConfirmDialogOpen,
setConfirmDialogProps,
finishConfirm,

Loading…
Cancel
Save