diff --git a/src/Threads/RecentThreads.js b/src/Threads/RecentThreads.js index 3a4baeaccec46c7ea0159f9720852e4db013cb42..a19c9044e5b02c566ad0a03f553f3a512960436f 100644 --- a/src/Threads/RecentThreads.js +++ b/src/Threads/RecentThreads.js @@ -25,7 +25,7 @@ export default function Topic(props){ useEffect(() => { const fetch = async () => { - const responseThreads = await axios.get(`http://localhost:4000/api/threads/pages/recent/?page=${currentPage}`) + const responseThreads = await axios.get(`${API_URL}/threads/pages/recent/?page=${currentPage}`) setThread(responseThreads.data.data) } fetch() @@ -34,8 +34,8 @@ export default function Topic(props){ useEffect(() => { async function getTotalItems() { - const allThreads = await axios.get(`http://localhost:4000/api/threads/pages/recent/`); - const totalItems = allThreads.metadata.total_data; + const allThreads = await axios.get(`${API_URL}/threads/pages/recent/`); + const totalItems = allThreads.data.metadata.total_data; setTotalItems(totalItems); } getTotalItems(); @@ -48,7 +48,7 @@ export default function Topic(props){ async function getThreadsByPage(pageNumber) { setThread([]); - const threadsList = await axios.get(`http://localhost:4000/api/threads/pages/recent/?page=${pageNumber}`) + const threadsList = await axios.get(`${API_URL}/threads/pages/recent/?page=${pageNumber}`) setThread(threadsList.data.data) } @@ -58,7 +58,7 @@ export default function Topic(props){ thread={thread}> </ThreadList> <Pagination - url="http://localhost:4000/api/threads/pages/recent" + url="${API_URL}/threads/pages/recent" changePage={changePage} totalItems={totalItems} /> diff --git a/src/services/api_link.js b/src/services/api_link.js index 1a5662533ba07280869c27662603f12e05293c16..851d0febe84722485e276c58dd49db864539ead4 100644 --- a/src/services/api_link.js +++ b/src/services/api_link.js @@ -1,2 +1,2 @@ -export const API_URL = 'https://diskuyapi.herokuapp.com/api' -// export const API_URL = 'http://localhost:4000/api' \ No newline at end of file +// export const API_URL = 'https://diskuyapi.herokuapp.com/api' +export const API_URL = 'http://localhost:4000/api' \ No newline at end of file