use variable for api base url
This commit is contained in:
parent
82bd76618c
commit
dc67c7eb10
@ -3,11 +3,13 @@ import {useEffect, useState} from "react";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import PostList from "./components/Post/PostList";
|
import PostList from "./components/Post/PostList";
|
||||||
|
|
||||||
|
const apiUrl = "http://localhost:8000";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [postList, setPostsList] = useState([]);
|
const [postList, setPostsList] = useState([]);
|
||||||
|
|
||||||
const fetchPosts = async () => {
|
const fetchPosts = async () => {
|
||||||
await axios.get("http://localhost:8000/catalog")
|
await axios.get(apiUrl + "/catalog")
|
||||||
.then((response) => { setPostsList(response.data)})
|
.then((response) => { setPostsList(response.data)})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,4 +40,4 @@ function App() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
Loading…
Reference in New Issue
Block a user