feat: globally set robot state
This commit is contained in:
@@ -55,9 +55,8 @@ interface RobotSettingsProps {
|
|||||||
|
|
||||||
export const RobotDuplicationModal = ({ isOpen, handleStart, handleClose, initialSettings }: RobotSettingsProps) => {
|
export const RobotDuplicationModal = ({ isOpen, handleStart, handleClose, initialSettings }: RobotSettingsProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [robot, setRobot] = useState<RobotSettings | null>(null);
|
|
||||||
const [targetUrl, setTargetUrl] = useState<string | undefined>('');
|
const [targetUrl, setTargetUrl] = useState<string | undefined>('');
|
||||||
const { recordingId, notify } = useGlobalInfoStore();
|
const { recordingId, notify, robot, setRobot } = useGlobalInfoStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
@@ -99,10 +98,6 @@ export const RobotDuplicationModal = ({ isOpen, handleStart, handleClose, initia
|
|||||||
notify('success', t('robot_duplication.notifications.duplicate_success'));
|
notify('success', t('robot_duplication.notifications.duplicate_success'));
|
||||||
handleStart(robot);
|
handleStart(robot);
|
||||||
handleClose();
|
handleClose();
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.reload();
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
} else {
|
||||||
notify('error', t('robot_duplication.notifications.duplicate_error'));
|
notify('error', t('robot_duplication.notifications.duplicate_error'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user