diff --git a/src/backend/src/controllers/onboarding.controller.ts b/src/backend/src/controllers/onboarding.controller.ts index 9c89420e78..2bd8660a35 100644 --- a/src/backend/src/controllers/onboarding.controller.ts +++ b/src/backend/src/controllers/onboarding.controller.ts @@ -5,7 +5,6 @@ export default class OnboardingController { static async downloadImage(req: Request, res: Response, next: NextFunction) { try { const { fileId } = req.params; - console.log('FILE ID:', fileId); const imageData = await OnboardingServices.downloadImage(fileId); diff --git a/src/frontend/src/apis/onboarding.api.ts b/src/frontend/src/apis/onboarding.api.ts index e6cbf8c53a..7912e80516 100644 --- a/src/frontend/src/apis/onboarding.api.ts +++ b/src/frontend/src/apis/onboarding.api.ts @@ -10,7 +10,6 @@ export const downloadGoogleImage = async (fileId: string): Promise => { const response = await axios.get(apiUrls.imageById(fileId), { responseType: 'arraybuffer' // Set the response type to 'arraybuffer' to receive the image as a Buffer }); - console.log('ID IN API:', fileId); const imageBuffer = new Uint8Array(response.data); const imageBlob = new Blob([imageBuffer], { type: response.headers['content-type'] }); return imageBlob; diff --git a/src/frontend/src/apis/organizations.api.ts b/src/frontend/src/apis/organizations.api.ts index 47311f1f19..7c7f37af1f 100644 --- a/src/frontend/src/apis/organizations.api.ts +++ b/src/frontend/src/apis/organizations.api.ts @@ -41,3 +41,18 @@ export const setOrganizationFeaturedProjects = async (featuredProjectIds: string projectIds: featuredProjectIds }); }; + +/** + * Downloads a given fileId from google drive into a blob + * + * @param fileId the google id of the file to download + * @returns the downloaded file as a Blob + */ +export const downloadGoogleImage = async (fileId: string): Promise => { + const response = await axios.get(apiUrls.imageById(fileId), { + responseType: 'arraybuffer' // Set the response type to 'arraybuffer' to receive the image as a Buffer + }); + const imageBuffer = new Uint8Array(response.data); + const imageBlob = new Blob([imageBuffer], { type: response.headers['content-type'] }); + return imageBlob; +}; diff --git a/src/frontend/src/hooks/organizations.hooks.ts b/src/frontend/src/hooks/organizations.hooks.ts index ddcbaf1190..573ece5bdb 100644 --- a/src/frontend/src/hooks/organizations.hooks.ts +++ b/src/frontend/src/hooks/organizations.hooks.ts @@ -10,7 +10,7 @@ import { setOrganizationLogo, setOrganizationFeaturedProjects } from '../apis/organizations.api'; -import { downloadGoogleImage } from '../apis/onboarding.api'; +import { downloadGoogleImage } from '../apis/organizations.api'; interface OrganizationProvider { organizationId: string;