I am trying to return last inserted value using model. my function is
async addBook(data)
{
await db.BOOK.create(data).then((BOOK) => {
console.log("BOOK_KEY",BOOK.BOOK_KEY);
return BOOK.BOOK_KEY;
})
}
BOOK_KEY is not printing.
let bookId = this.addBook(data)
console.log("bookId", bookId);
and Here bookId is going state
bookId Promise { <pending> }
Kindly help me to display bookId. Thanks in advance.