Is (3) a correct way of using then()? I don't need the Promise returned by fetch(), I just want obtain an updated array of emails once fetch() is done.
Are my comments for (1) (2) and (3) correct? I tested them by running another then() (4) after each of them, and they seem right. I just want to be sure.
function setArchive(email_id, boolArchive) {
fetch(`/emails/${email_id}`, {
method: 'PUT',
body: JSON.stringify({
archived: boolArchive
})
})
##### (Using just one of these at a time)
(1) .then(load_mailbox('inbox')) // doesn't wait for fetch() to resolve, returned Promise accessible by the next then()
(2) .then((response) => load_mailbox('inbox')) // waits for fetch(), returned Promise NOT accessible by the next then() (4)
(3) .then(() => load_mailbox('inbox')) // waits for fetch(), returned Promise NOT accessible by the next then() (4)
#####
(4) .then(response => console.log(response)) // (2) and (3) logs 'undefined'
Thanks for your help.