feat: get google_sheet_mail + post request for google auth callback

This commit is contained in:
karishmas6
2024-10-17 00:15:28 +05:30
parent 700d302ea4
commit 137bac49a0

View File

@@ -36,9 +36,12 @@ export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: I
// Function to handle Google OAuth callback and fetch spreadsheets
const handleOAuthCallback = async () => {
try {
const response = await axios.get('http://localhost:8080/auth/google/callback');
const { email, files } = response.data;
setUserInfo({ email });
const response = await axios.post('http://localhost:8080/auth/google/callback', {
// code: new URLSearchParams(window.location.search).get('code'),
robotId: ''
});
const { google_sheet_email, files } = response.data;
setUserInfo({ email:google_sheet_email });
setSpreadsheets(files);
setIsAuthenticated(true);
} catch (error) {