From d15c7e1fadeb5a5f2745703bfb8cce1b6406c3cd Mon Sep 17 00:00:00 2001 From: Aadityavoru Date: Sun, 13 Jul 2025 23:59:05 -0700 Subject: [PATCH] url change --- src/components/Layout/Sidebar.js | 4 +++- src/components/authoring/RepositoryPanel.js | 7 ++----- .../pages/createsteps helpers/CreateStepsUtils.js | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Layout/Sidebar.js b/src/components/Layout/Sidebar.js index 72eaace..8d9a340 100644 --- a/src/components/Layout/Sidebar.js +++ b/src/components/Layout/Sidebar.js @@ -4,6 +4,7 @@ import { useAuth } from '../../contexts/authContext'; import { doSignOut } from '../../firebase/auth'; import { AiOutlineMenu, AiOutlineLogout, AiFillTool, AiOutlineVideoCamera as AiOutlineVideo, AiOutlineEye, AiOutlineArrowLeft, AiOutlineCheck, AiOutlineUser, AiOutlineDatabase, AiOutlineFolder, AiOutlineBarChart } from 'react-icons/ai'; import logo from '../../assets/trvise_logo.png'; +import { getApiUrl } from '../pages/createsteps helpers/CreateStepsUtils'; const Sidebar = ({ isCollapsed, toggleSidebar, animateLogo }) => { const navigate = useNavigate(); @@ -48,7 +49,8 @@ const Sidebar = ({ isCollapsed, toggleSidebar, animateLogo }) => { if (!currentUser?.uid) return; try { - const response = await fetch(`${process.env.REACT_APP_API_URL || 'http://localhost:8000'}/users/${currentUser.uid}`); + const apiUrl = getApiUrl(); + const response = await fetch(`${apiUrl}/users/${currentUser.uid}`); if (response.ok) { const data = await response.json(); setProfileData(data); diff --git a/src/components/authoring/RepositoryPanel.js b/src/components/authoring/RepositoryPanel.js index 7535845..de978fa 100644 --- a/src/components/authoring/RepositoryPanel.js +++ b/src/components/authoring/RepositoryPanel.js @@ -1,13 +1,10 @@ import React, { useState, useEffect, useCallback } from 'react'; import { useAuth } from '../../contexts/authContext'; import { AiOutlinePlus, AiOutlineSearch, AiOutlineEdit, AiOutlineDelete, AiOutlineClose, AiOutlineUpload } from 'react-icons/ai'; -import { uploadFileToFirebase } from '../pages/createsteps helpers/CreateStepsUtils'; +import { uploadFileToFirebase, getApiUrl } from '../pages/createsteps helpers/CreateStepsUtils'; import { repositoryStyles } from '../pages/Repository.styles'; -// Import the getApiUrl function to match the existing codebase pattern -const getApiUrl = () => { - return process.env.REACT_APP_API_URL || 'http://localhost:8000'; -}; +// No local getApiUrl function const RepositoryPanel = ({ contextType = 'main', onAddToStep, onAddToBuyList }) => { const { currentUser } = useAuth(); diff --git a/src/components/pages/createsteps helpers/CreateStepsUtils.js b/src/components/pages/createsteps helpers/CreateStepsUtils.js index 7af690f..92e9f3f 100644 --- a/src/components/pages/createsteps helpers/CreateStepsUtils.js +++ b/src/components/pages/createsteps helpers/CreateStepsUtils.js @@ -31,7 +31,7 @@ export const formatDate = (dateString) => { // API utility functions export const getApiUrl = () => { - return process.env.REACT_APP_API_URL || 'http://localhost:8000'; + return 'https://pbsggxqwqp.us-east-1.awsapprunner.com'; }; export const createApiCall = async (endpoint, options = {}) => {