Fakultas Ilmu Komputer UI

Commit 83197446 authored by FadhilP's avatar FadhilP
Browse files

add error handling in Topic get req

parent 995249d2
......@@ -15,7 +15,7 @@
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "set PORT=3000 && react-scripts start",
"start": "node server/server.js",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
......
......@@ -11,6 +11,7 @@ export default function Topic(props){
useEffect(() => {
const fetch = async () => {
try {
const responseThreads = await axios.get(`${API_URL}/threads/`)
const responseTopics = await axios.get(`${API_URL}/topics`)
......@@ -22,8 +23,7 @@ export default function Topic(props){
return 0
})
setThread(sortedThreads)
console.log(threads)
} catch(error){}
}
fetch()
}, [topicParam])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment