🚸 show error on board fetchData
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
This commit is contained in:
committed by
Julius Härtl
parent
6cd8173e98
commit
2e94b8e048
@@ -77,6 +77,7 @@ import Controls from '../Controls'
|
|||||||
import Stack from './Stack'
|
import Stack from './Stack'
|
||||||
import { EmptyContent } from '@nextcloud/vue'
|
import { EmptyContent } from '@nextcloud/vue'
|
||||||
import GlobalSearchResults from '../search/GlobalSearchResults'
|
import GlobalSearchResults from '../search/GlobalSearchResults'
|
||||||
|
import { showError } from '../../helpers/errors'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Board',
|
name: 'Board',
|
||||||
@@ -139,6 +140,7 @@ export default {
|
|||||||
await this.$store.dispatch('loadStacks', this.id)
|
await this.$store.dispatch('loadStacks', this.id)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
showError(e)
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
|
|||||||
27
src/helpers/errors.js
Normal file
27
src/helpers/errors.js
Normal 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,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user