Here is the code I have tried, when I try to return soc
it says it is undefined, I know this is because it is defined within a nested promise. My question is how can I return the result of my sql query without the use of a .then
promise as I do not fully understand them and they're just causing me pain.
async function get_charge_level() {
var config = {
<config_settings>
};
sql.setDefaultConfig(config);
await sql.execute( {
query: "some query"
} ).then(async function( id ) {
await sql.execute( {
query: "some other query"
} ).then(async function( soc ) {
})
})
return soc
}