From a tutorial book I the following code
createShoppingList: (store, shoppinglist) => {
return api.addNewShoppingList(shoppinglist).then(() => {
store.dispatch('populateShoppingLists')
}, () => {
store.commit(types.ADD_SHOPPING_LIST, shoppinglist)
})
}
notice the comma after the .then() block
Is it equivalent to a chained .then() ?
createShoppingList: (store, shoppinglist) => {
return api.addNewShoppingList(shoppinglist)
.then(() => {
store.dispatch('populateShoppingLists')
})
.then(() => {
store.commit(types.ADD_SHOPPING_LIST, shoppinglist)
})
}
or is it only a block inside the .then() ? like :
return api.addNewShoppingList(shoppinglist)
.then(
() => { store.dispatch('populateShoppingLists')},
() => { store.commit(types.ADD_SHOPPING_LIST, shoppinglist) }
)
thanks for feedback