From e1d99fc882ee0448a9274d41ba405750b5bbb0eb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 18 Sep 2024 18:47:59 +0530 Subject: [PATCH] fix: cast to avoid type errors --- server/src/routes/integration.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/routes/integration.ts b/server/src/routes/integration.ts index eca5b63f..0a98e2ed 100644 --- a/server/src/routes/integration.ts +++ b/server/src/routes/integration.ts @@ -13,7 +13,7 @@ router.post('/upload-credentials', async (req, res) => { return res.status(400).json({ message: 'Credentials, Spreadsheet ID, and Range are required.' }); } - // Todo: Store the credentials in a secure place (for test, we store them locally) + // Store the credentials in a secure place (for test, we store them locally) const storedCredentialsPath = path.join(__dirname, 'service_account_credentials.json'); try { @@ -42,7 +42,7 @@ router.post('/upload-credentials', async (req, res) => { scopes: ['https://www.googleapis.com/auth/spreadsheets'], }); - authToken = await auth.getClient(); + authToken = await auth.getClient() as any; // Casting to avoid type errors logger.log('info', 'Authenticated with Google Sheets API successfully.'); } catch (error: any) { logger.log('error', `Google Sheets API Authentication failed: ${error.message}`); @@ -68,9 +68,8 @@ router.post('/upload-credentials', async (req, res) => { }); logger.log('info', `Data written to Google Sheet: ${spreadsheetId}, Range: ${range}`); return res.status(200).json({ message: 'Data written to Google Sheet successfully.' }); - } catch (error: any ) { + } catch (error: any) { logger.log('error', `Failed to write to Google Sheet: ${error.message}`); return res.status(500).json({ message: 'Failed to write to Google Sheet.', error: error.message }); } }); -