How can I make redux dispatch an action as well as return a promise?
问题 Here is my function in songAction.js export function createSong(title, url, token) { axios.defaults.headers.common['Authorization'] = token return function (dispatch) { axios.post('http://localhost:8080/api/song/create', { title, link: url }) .then((response) => { console.log('the response was', response) if(response.data.success){ dispatch({type: "CREATE_SONG_FULFILLED", payload: response.data.song}) } else { dispatch({type: "CREATE_SONG_REJECTED", payload: response.data}) } }) .catch((err)