From edebbd2f6d4c7223e34efc31c5ccb207bb5fef74 Mon Sep 17 00:00:00 2001 From: "Taylor Wilsdon (aider)" Date: Mon, 16 Dec 2024 14:48:19 -0500 Subject: [PATCH] refactor: Retrieve Google Drive credentials from main config endpoint --- src/lib/utils/google-drive-picker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/utils/google-drive-picker.ts b/src/lib/utils/google-drive-picker.ts index 0232679f9..df10eccf1 100644 --- a/src/lib/utils/google-drive-picker.ts +++ b/src/lib/utils/google-drive-picker.ts @@ -4,13 +4,17 @@ let CLIENT_ID = ''; // Function to fetch credentials from backend config async function getCredentials() { - const response = await fetch('/api/google-drive/config'); + const response = await fetch('/api/config'); if (!response.ok) { throw new Error('Failed to fetch Google Drive credentials'); } const config = await response.json(); API_KEY = config.google_drive?.api_key; CLIENT_ID = config.google_drive?.client_id; + + if (!API_KEY || !CLIENT_ID) { + throw new Error('Google Drive API credentials not configured'); + } } const SCOPE = [ 'https://www.googleapis.com/auth/drive.readonly',