const bet = req.body.bet
const creator_id = req.user
let company_id
const company_data = new Promise(async(resolve,reject) => {
await pool.query(`select * from the_company where creator_id = ?`, {creator_id}, (error,results,fields) => {
const id = results.map(r => r.id)
const name = results.map(r => r.name) //Ответ - { id: '41' } - id
console.log(`${id} - id`)
resolve(id)
})
})
company_data.then(r => {
console.log(r) //Ответ - []
})
const company_data = () => new Promise((resolve,reject) => {
pool.query(`select * from the_company where creator_id = ?`, {creator_id}, (error,results,fields) => {
const id = results.map(r => r.id)
const name = results.map(r => r.name) //Ответ - { id: '41' } - id
console.log(`${id} - id`)
resolve(id)
})
})