refactored MainContent component

This commit is contained in:
andres alcocer
2021-10-07 13:40:50 -04:00
parent d3b5081a2a
commit 40d4a3cfba
3 changed files with 21 additions and 164 deletions

View File

@@ -40,13 +40,13 @@ export const fetchNetflixOriginals = () => {
}
export const fetchTrending = () => {
const request = axios.get(
`/trending/all/week?api_key=${process.env.API_KEY}&language=en-US`
)
return {
type: FETCH_TRENDING,
payload: request,
return async (dispatch) => {
try {
const request = await axios.get(
`/trending/all/week?api_key=${process.env.API_KEY}&language=en-US`
)
dispatch({ type: FETCH_TRENDING, payload: request })
} catch (error) {}
}
}