Merge pull request #3653 from nextcloud/feature/show-error-on-boad-fetchdata

🚸 Shows error on board fetchData
This commit is contained in:
Julius Härtl
2022-03-21 14:56:43 +01:00
committed by GitHub
2 changed files with 29 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ import Controls from '../Controls'
import Stack from './Stack'
import { EmptyContent } from '@nextcloud/vue'
import GlobalSearchResults from '../search/GlobalSearchResults'
import { showError } from '../../helpers/errors'
export default {
name: 'Board',
@@ -139,6 +140,7 @@ export default {
await this.$store.dispatch('loadStacks', this.id)
} catch (e) {
console.error(e)
showError(e)
}
this.loading = false
},

27
src/helpers/errors.js Normal file
View File

@@ -0,0 +1,27 @@
import { showError as errorDialog } from '@nextcloud/dialogs'
const showAxiosError = err => {
const response = err?.response || {}
const message = response?.data.message
if (message) {
errorDialog(message)
return
}
errorDialog(err.message)
}
const showError = err => {
// axios error
if (err.response) {
showAxiosError(err)
return
}
errorDialog(err.message)
}
export {
showError,
}