This is my first file with function 1
import React, {Component} from "react";
import axios from 'axios';
import { config } from '../../config/config.js';
class Dashboard extends Component {
constructor(props) {
super(props);
}
componentWillMount(){
var obj = {
campaign:campaignName,
campaignId:campaignId,
clientId:clientId,
clientName:clentName,
end:endDate,
start:startDate,
timeZone:new Date().getTimezoneOffset(),
ReportName:'Chargebacks',
widgetName:'Billing Cycle'
}
var resdata = ChartAPI.widgetApiCalls(config.apiUrl,obj);
console.log(resdata );
}
}
And this is another one with function 2
import axios from 'axios';
function charts(){
this.widgetApiCalls = function(url,parmsobj){
var byresspose=[];
axios.get(url+"/reports",{params:parmsobj})
.then(function(response){
for(var i in response.data){
byresspose.push({"label":"Billing Cycle"+" "+response.data[i].billingCycle,"value":response.data[i].total})
}
console.log(byresspose);
});
return byresspose;
};
}
charts = new charts();
module.exports = charts;
What is the correct way to pass parameter from one function 1 to another function 2?