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 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)})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user