Привет всем. Есть идеи как можно прервать promise chain?
const promise = new Promise(resolve => resolve())
promise
.then(() => { /* Your code here */ })
.then(() => { /* Your code here */ })
.catch(e => { /* Your code here */ })
.then(() => { console.log('This should not be printed') })
let cancel = false
promise
.then(() => { cancel = true )
.then(() => { /* Your code here */ })
.catch(e => { /* Your code here */ })
.then(() => {
if (cancel) return
console.log('This should not be printed') })