Here, I need what customerData return but when in print customerData i got undefined
if( phone === "" || phone === null || phone === undefined ) {
var customerData = pool.query('SELECT * FROM customers WHERE licensenumber = $1 ',[Licensenumber], (error, result) => {
var customerData = result.rows;
if (error) {
throw error
}
res.status(200).json(result.rows)
})
}
else{
var customerData =pool.query('SELECT * FROM customers WHERE licensenumber = $1 AND phone = $2'
[Licensenumber,phone], (error, result) => {
var customerData = result.rows;
if (error) {
throw error
}
res.status(200).json(result.rows)
})
}
console.log(customerData);
//// i need to check what customerData return