The following code is making two asynchronous requests to obtain the desired data. The second request needs to access the data from the first request, hence I need to nest it. I know that it is better to chain promises, but this is a case where nesting seems necessary.
However the lint
raises a warning: avoid nesting promises. Should I ignore the warning or there is a better way to rewrite the code?
function get_note_full(note_id) {
return db.collection('notes').doc(note_id).get()
.then(doc => {
const data = doc.data();
return get_author_data(data.author_uid)
.then(author => {
return ({
id: note_id,
title: data.title,
text: data.text,
author: author
});
});
});
}