From 4fbd3783856c35aa02cac626a2829ce15feb07fc Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 17 Oct 2024 17:29:56 +0530 Subject: [PATCH] feat: send the selected google sheet id --- src/components/molecules/IntegrationSettings.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/molecules/IntegrationSettings.tsx b/src/components/molecules/IntegrationSettings.tsx index af17c79e..9ce3690e 100644 --- a/src/components/molecules/IntegrationSettings.tsx +++ b/src/components/molecules/IntegrationSettings.tsx @@ -60,6 +60,20 @@ export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: I console.error('Error fetching spreadsheet files:', error.response?.data?.message || error.message); } }; + + // Function to send the selected sheet ID to the backend to update the robot's google_sheet_id +const updateGoogleSheetId = async () => { + try { + const response = await axios.post( + `http://localhost:8080/auth/gsheets/update`, + { spreadsheetId: settings.spreadsheetId, robotId: recordingId }, + { withCredentials: true } + ); + console.log('Google Sheet ID updated:', response.data); + } catch (error) { + console.error('Error updating Google Sheet ID:', error.response?.data?.message || error.message); + } +}; // Handle spreadsheet selection