Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (dispatch) => {
return fetch('http://localhost:3000/api/products', {
method: 'GET',
headers
}).then((response) => {
return response.json().then((data) => {
return dispatch({
type: GET_PRODUCTS,
notifications: data
});
});
}).catch(() => {
return dispatch({ type: `${GET_PRODUCTS}_ERROR` });
});
};
}