from tutorial book following code
createshoppinglist: (store, shoppinglist) => { return api.addnewshoppinglist(shoppinglist).then(() => { store.dispatch('populateshoppinglists') }, () => { store.commit(types.add_shopping_list, shoppinglist) }) } notice comma after .then() block
is equivalent chained .then() ?
createshoppinglist: (store, shoppinglist) => { return api.addnewshoppinglist(shoppinglist) .then(() => { store.dispatch('populateshoppinglists') }) .then(() => { store.commit(types.add_shopping_list, shoppinglist) }) } or block inside .then() ? :
return api.addnewshoppinglist(shoppinglist) .then( () => { store.dispatch('populateshoppinglists')}, () => { store.commit(types.add_shopping_list, shoppinglist) } ) thanks feedback
no
.then(resolved, rejected) is not equal to
.then(resolve) .then(rejected)// :/ its rather similar to:
.then(resolved) .catch(rejected) (theres still difference rejection inside of catched now, while upper version uncatched)
Comments
Post a Comment