Skip to content

Commit

Permalink
fix(fetch): only clear errors when there are errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 13, 2020
1 parent 4ac0495 commit fd808e6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ export default {
* @param {*} param0
* @param {String} url URL to fetch
*/
async simpleFetch({ dispatch }, { url, options }) {
async simpleFetch({ state, dispatch }, { url, options }) {
dispatch('loadingAnimationHandler', 'start')

await dispatch({
type: 'errorManager',
operation: 'reset',
})
if (state.errors) {
await dispatch({
type: 'errorManager',
operation: 'reset',
})
}

const data = await fetch(url, options)
// Save the data
Expand Down

0 comments on commit fd808e6

Please sign in to comment.