diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx index 74ff7c8511..977b274ac0 100644 --- a/frontend/src/container/GridGraphLayout/Graph/index.tsx +++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx @@ -124,6 +124,38 @@ const GridCardGraph = ({ [], ); + const getModals = () => { + return ( + <> + onToggleModal(setDeletModal)} + visible={deleteModal} + title="Delete" + height="10vh" + onOk={onDeleteHandler} + centered + > + Are you sure you want to delete this widget + + + onToggleModal(setModal)} + width="85%" + destroyOnClose + > + + + + + + ); + }; + const onDeleteHandler = useCallback(() => { deleteWidget({ widgetId: widget.id }); onToggleModal(setDeletModal); @@ -133,6 +165,7 @@ const GridCardGraph = ({ if (state.error) { return ( <> + {getModals()} onToggleModal(setModal)} widget={widget} @@ -156,31 +189,7 @@ const GridCardGraph = ({ onDeleteHandler={(): void => onToggleModal(setDeletModal)} /> - onToggleModal(setDeletModal)} - visible={deleteModal} - title="Delete" - height="10vh" - onOk={onDeleteHandler} - centered - > - Are you sure you want to delete this widget - - - onToggleModal(setModal)} - width="85%" - destroyOnClose - > - - - - + {getModals()}