fix: graphql error notifications
This commit is contained in:
parent
7e62c01ed1
commit
959f2ebde1
@ -204,6 +204,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async save() {
|
async save() {
|
||||||
this.$store.commit(`loadingStart`, 'admin-auth-savestrategies')
|
this.$store.commit(`loadingStart`, 'admin-auth-savestrategies')
|
||||||
|
try {
|
||||||
await this.$apollo.mutate({
|
await this.$apollo.mutate({
|
||||||
mutation: strategiesSaveMutation,
|
mutation: strategiesSaveMutation,
|
||||||
variables: {
|
variables: {
|
||||||
@ -227,6 +228,9 @@ export default {
|
|||||||
style: 'success',
|
style: 'success',
|
||||||
icon: 'check'
|
icon: 'check'
|
||||||
})
|
})
|
||||||
|
} catch (err) {
|
||||||
|
this.$store.commit('pushGraphError', err)
|
||||||
|
}
|
||||||
this.$store.commit(`loadingStop`, 'admin-auth-savestrategies')
|
this.$store.commit(`loadingStop`, 'admin-auth-savestrategies')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -229,11 +229,7 @@ export default {
|
|||||||
this.siteTitle = this.config.title
|
this.siteTitle = this.config.title
|
||||||
this.company = this.config.company
|
this.company = this.config.company
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
style: 'red',
|
|
||||||
message: err.message,
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -93,11 +93,7 @@ export default {
|
|||||||
icon: 'check'
|
icon: 'check'
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
style: 'red',
|
|
||||||
message: err.message,
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async deleteGroup() {
|
async deleteGroup() {
|
||||||
@ -119,11 +115,7 @@ export default {
|
|||||||
})
|
})
|
||||||
this.$router.replace('/groups')
|
this.$router.replace('/groups')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
style: 'red',
|
|
||||||
message: err.message,
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async refresh() {
|
async refresh() {
|
||||||
|
@ -149,11 +149,7 @@ export default {
|
|||||||
icon: 'check'
|
icon: 'check'
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
style: 'red',
|
|
||||||
message: err.message,
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -180,11 +180,7 @@ export default {
|
|||||||
icon: 'check'
|
icon: 'check'
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
style: 'red',
|
|
||||||
message: err.message,
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -214,11 +214,7 @@ export default {
|
|||||||
throw new Error(_.get(resp, 'data.navigation.updateTree.responseResult.message', 'An unexpected error occured.'))
|
throw new Error(_.get(resp, 'data.navigation.updateTree.responseResult.message', 'An unexpected error occured.'))
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
message: err.message,
|
|
||||||
style: 'red',
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
this.$store.commit(`loadingStop`, 'admin-navigation-save')
|
this.$store.commit(`loadingStop`, 'admin-navigation-save')
|
||||||
},
|
},
|
||||||
|
@ -146,11 +146,7 @@ export default {
|
|||||||
throw new Error(resp.message)
|
throw new Error(resp.message)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('pushGraphError', err)
|
||||||
message: `Error: ${err.message}`,
|
|
||||||
style: 'error',
|
|
||||||
icon: 'warning'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
this.$store.commit(`loadingStop`, 'admin-theme-save')
|
this.$store.commit(`loadingStop`, 'admin-theme-save')
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
@ -47,6 +47,13 @@ export default new Vuex.Store({
|
|||||||
},
|
},
|
||||||
updateNotificationState (state, newState) {
|
updateNotificationState (state, newState) {
|
||||||
state.notification.isActive = newState
|
state.notification.isActive = newState
|
||||||
|
},
|
||||||
|
pushGraphError (state, err) {
|
||||||
|
WIKI.$store.commit('showNotification', {
|
||||||
|
style: 'red',
|
||||||
|
message: _.get(err, 'graphQLErrors[0].message', err.message),
|
||||||
|
icon: 'warning'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: { },
|
actions: { },
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const graphHelper = require('../../helpers/graph')
|
const graphHelper = require('../../helpers/graph')
|
||||||
const safeRegex = require('safe-regex')
|
const safeRegex = require('safe-regex')
|
||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user