Ethereum transaction promise never call

I’m current learning web3 with ethereum transaction. Current i have the following code:

await web3.eth.sendTransaction({             from: account,             gasPrice: "20000000000",             gas: "21000",             to: "0x8E6B95659EA323Ef0DC115F8d33d1ea61bF8b5a8",             value:"2000000000000000",             data: ""         })         .then(tx => {   `/api/calltoserver`, {                 account: account,                 amount: value,                 swapCode: swapCode,                 tx             })         }) 

When i’m refresh the page or do something else (till wait for confirmation) it never call the .then method.

can someone tell me what is the best way to do this kind of transactions?

Like this in production means a user can call the function till it not have confirmed.

I need basically the TX Hash before it submit to the Ether chain.

Ethereum transaction promise never call

Shopping cart
There are no products in the cart!
Continue shopping