I am currently fetching data from one endpoint. I want to store another api endpoints data in a state variable in the onload function. However I am not to sure how to fetch multiple end points.
the second end point which I need to call:
'/api/get_all_test_types'
This shows the code used to fetch one end point
useEffect(() => {
async function onLoadCreateUnitTests() {
const results = await get('get_tables_autocomplete/b', user.user)
autoComplete.setTablesAutoComplete(results)
}
onLoadCreateUnitTests()
}, [])
MarkCBall Code:
useEffect(() => {
async function onLoadCreateUnitTests() {
const results = await get('get_tables_autocomplete/b', user.user)
const resultsAllTestTypes = await get('/api/get_all_test_types')
autoComplete.setTablesAutoComplete(results)
setAllTestTypes(resultsAllTestTypes)
}
onLoadCreateUnitTests()
}, [])
