{"size": 1166, "ext": "js", "max_stars_repo_path": "src/app/redux/chaincode/sendlastprice.js", "max_stars_repo_name": "patientplatypus/GoFrontendFinancialBlockchain", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/app/redux/chaincode/sendlastprice.js", "max_issues_repo_name": "patientplatypus/GoFrontendFinancialBlockchain", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/app/redux/chaincode/sendlastprice.js", "max_forks_repo_name": "patientplatypus/GoFrontendFinancialBlockchain", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.347826087, "max_line_length": 73, "alphanum_fraction": 0.6552315609}
import axios from 'axios';

const url = 'http://localhost:8000/exchangetochain'



export const sendLASTPRICE = ({payload}) => {
  return (dispatch) => {
    var sendurl = url
    console.log('value of payload: ', payload);
    console.log('value of sendurl: ', sendurl);
    console.log('value of timestamp: ', payload["timestamp"]);
    axios.post(sendurl, {
      symbol: payload.symbol,
      timestamp: payload.timestamp.toString(),
      lastprice: payload.lastprice
    })
    .then((response)=>{
      console.log('value of response from sendlastprice: ', response);
      dispatch(AXIOSRETURNLASTPRICE(response.data))
    })
    .catch(error => {
      console.log('inside error from login auth and response : ', error);
      dispatch(AXIOSERRORLASTPRICE(error))
    })
  }
}

//HERE ARE THE ACTIONS ->>> REDUCERS

export const AXIOSRETURNLASTPRICE = (payload) => {
  console.log('inside AXIOSRETURN and payload ', payload);
  return{
    type: 'LAST_PRICE',
    data: payload
  }
}

export const AXIOSERRORLASTPRICE = (payload) => {
  console.log('inside AXIOSERROR and payload ', payload);
  return{
    type: 'LAST_PRICE_ERROR',
    data: payload
  }
}
