From dc67c7eb10fcdf0e474543c8758b172865512b36 Mon Sep 17 00:00:00 2001 From: agatha Date: Tue, 9 Apr 2024 17:50:06 -0400 Subject: [PATCH] use variable for api base url --- frontend/app/src/App.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app/src/App.js b/frontend/app/src/App.js index 45f7602..1cade45 100644 --- a/frontend/app/src/App.js +++ b/frontend/app/src/App.js @@ -3,11 +3,13 @@ import {useEffect, useState} from "react"; import axios from "axios"; import PostList from "./components/Post/PostList"; +const apiUrl = "http://localhost:8000"; + function App() { const [postList, setPostsList] = useState([]); const fetchPosts = async () => { - await axios.get("http://localhost:8000/catalog") + await axios.get(apiUrl + "/catalog") .then((response) => { setPostsList(response.data)}) } @@ -38,4 +40,4 @@ function App() { ); } -export default App; \ No newline at end of file +export default App;