Good morning,
I don’t know if my title is understandable but I would like to be able to have a const with parameters to be able to choose what to send with axios. Basically i have this :
const {send1='', send1_1= '', send2='', send2_2 = '' } = this.state;
await axios.post(' MY_API/default/serverlessAppFunction',
{ key1: `${send1}, ${send1_1}`, key2: `${send2}, ${send2_2}`},);
I would like to know if it was possible to declare a variable somewhere else, to put it in axios. A little bit like this :
const key3 : `${test3}, ${test3_3}`;
const {send1='', send1_1= '', send2='', send2_2 = '', test3= '', test3_3=''} = this.state;
await axios.post(' MY_API/default/serverlessAppFunction',
{ key1: `${send1}, ${send1_1}`, key2: `${send2}, ${send2_2}`, key3},);
The example it's not working of course.
But globally, i would like to do a thing like that. And if it's possible, How do I declare this variable and in what form?
i'm talking about declare like this or in another way
const key3 = "${test3}, ${test3_3}";
(Sorry if I’m not specific, I don’t speak very well English) Thanks.