Skip to content

Commit

Permalink
🚸 show error on board fetchData
Browse files Browse the repository at this point in the history
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
  • Loading branch information
Vinicius Reis committed Mar 18, 2022
1 parent 2aed4c1 commit c08dc1a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -139,6 +140,7 @@ export default {
await this.$store.dispatch('loadStacks', this.id)
} catch (e) {
console.error(e)
showError(e)
}
this.loading = false
},
Expand Down
27 changes: 27 additions & 0 deletions src/helpers/errors.js
Original file line number Diff line number Diff line change
@@ -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,
}

0 comments on commit c08dc1a

Please sign in to comment.