From 8393d179ef97fee2c8fa844a80a19b21877a36f6 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Mon, 18 Nov 2024 06:12:35 +0530 Subject: [PATCH] chore: lint --- src/components/molecules/RobotEdit.tsx | 50 +++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/components/molecules/RobotEdit.tsx b/src/components/molecules/RobotEdit.tsx index 467679e1..f26765a3 100644 --- a/src/components/molecules/RobotEdit.tsx +++ b/src/components/molecules/RobotEdit.tsx @@ -20,8 +20,8 @@ interface RobotWorkflow { } interface RobotEditOptions { - name: string; - limit?: number; + name: string; + limit?: number; } interface ScheduleConfig { @@ -85,9 +85,9 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin const handleLimitChange = (newLimit: number) => { setRobot((prev) => { if (!prev) return prev; - + const updatedWorkflow = [...prev.recording.workflow]; - + if ( updatedWorkflow.length > 0 && updatedWorkflow[0]?.what && @@ -98,33 +98,33 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin ) { updatedWorkflow[0].what[0].args[0].limit = newLimit; } - + return { ...prev, recording: { ...prev.recording, workflow: updatedWorkflow } }; }); }; const handleSave = async () => { if (!robot) return; - - try { - const payload = { - name: robot.recording_meta.name, - limit: robot.recording.workflow[0]?.what[0]?.args?.[0]?.limit, - }; - - const success = await updateRecording(robot.recording_meta.id, payload); - - if (success) { - notify('success', 'Robot updated successfully.'); - handleStart(robot); // Inform parent about the updated robot - handleClose(); // Close the modal - window.location.reload(); - } else { - notify('error', 'Failed to update the robot. Please try again.'); - } + try { + const payload = { + name: robot.recording_meta.name, + limit: robot.recording.workflow[0]?.what[0]?.args?.[0]?.limit, + }; + + const success = await updateRecording(robot.recording_meta.id, payload); + + if (success) { + notify('success', 'Robot updated successfully.'); + handleStart(robot); // Inform parent about the updated robot + handleClose(); // Close the modal + + window.location.reload(); + } else { + notify('error', 'Failed to update the robot. Please try again.'); + } } catch (error) { - notify('error', 'An error occurred while updating the robot.'); - console.error('Error updating robot:', error); + notify('error', 'An error occurred while updating the robot.'); + console.error('Error updating robot:', error); } }; @@ -159,7 +159,7 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin style={{ marginBottom: '20px' }} /> )} - +