TransWikia.com

api not call using dispatch

Stack Overflow Asked by CodeTribe on January 31, 2021

I am trying to call the api and write the following function in react and using redux

export function fetchRecordingJson(file_name) {
  return (dispatch, getState) => {
    return axios.post(API_URL+`fetchjson/`, {file_name})
      .then(json => {
        dispatch(receiveJSON(json.data, file_name))
        console.log(dispatch(receiveJSON(json.data, file_name)));
      })
  }
}

and call it using the syntax

dispatch(fetchREcordingJson(file_name))

When it hit the function it not hitting the api and return any result, any one who work on functions using dispatch can help me to understand the issue

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP