Browse Source

Add toasts for all axios errors

master
squeaky otter 1 year ago
parent
commit
aafa9a51a0
Signed by: dashie GPG Key ID: C2D57B325840B755
  1. 10
      front/src/components/Shelf.vue
  2. 9
      front/src/views/Login.vue
  3. 7
      front/src/views/SearchNew.vue

10
front/src/components/Shelf.vue

@ -258,7 +258,8 @@ export default {
this.errorFetching = false
})
.catch((error) => {
console.log('Got an error while trying to save item:', error.request, error.response)
console.log('Got an error while trying to fetch items:', error)
this.$bvToast.toast(`Cannot fetch items.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
this.loadingErrors.item = true
})
},
@ -267,7 +268,8 @@ export default {
this.choosen.item = resp.data
this.choosen.loaded = true
}).catch((error) => {
console.log('Got an error while trying to load item subitems:', error.request, error.response)
console.log('Got an error while trying to load item subitems:', error)
this.$bvToast.toast(`Cannot fetch search item informations.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
this.loadingErrors.subitems = true
})
},
@ -308,6 +310,7 @@ export default {
}
})
.catch((error) => {
this.$bvToast.toast(`Cannot delete item.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
console.log(`Got an error while trying to delete the item ${flake_id}:`, error)
})
}
@ -333,6 +336,7 @@ export default {
})
.catch((error) => {
console.log('Got an error while trying to add a subitem:', error)
this.$bvToast.toast(`Cannot add sub item.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
this.errorSavingSubitem = true
})
}
@ -358,10 +362,12 @@ export default {
this.fetchItems(this.current_page)
} else {
console.log("We didn't got OK while removing the subitem :(", resp.data)
this.$bvToast.toast(`There might have been an error.`, {title: 'Warning', variant: 'warning', solid: true, autoHideDelay: 4000, appendToast: false})
}
})
.catch((error) => {
console.log(`Got an error while trying to delete the subitem ${flake_id}/${subitem_id}:`, error)
this.$bvToast.toast(`Cannot delete sub item.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
})
}
})

9
front/src/views/Login.vue

@ -57,7 +57,14 @@ export default {
this.$router.push({ name: 'Home' })
}
})
.catch((error) => {
console.log('Login check returned an error:', error)
this.$bvToast.toast(`Cannot verify login.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
})
})
.catch((error) => {
console.log('Login error:', error)
this.$bvToast.toast(`Cannot log in.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
})
}
}

7
front/src/views/SearchNew.vue

@ -127,6 +127,10 @@ export default {
this.results = resp.data.results
this.warn = this.count > this.page_size
})
.catch((error) => {
console.log('Got an error while trying to fetch item:', error)
this.$bvToast.toast(`Cannot fetch search items.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
})
},
cancelItem: function () {
this.choosen = {}
@ -155,7 +159,8 @@ export default {
this.$refs['modal-add'].hide()
})
.catch((error) => {
console.log('Got an error while trying to save item:', error.request, error.response)
console.log('Got an error while trying to save item:', error)
this.$bvToast.toast(`Cannot save item.`, {title: 'Error', variant: 'danger', solid: true, autoHideDelay: 4000, appendToast: false})
this.errorSaving = true
})
}

Loading…
Cancel
Save