Skip to content

Commit 47ca956

Browse files
authored
Set error message on GraphQL errors as well (rapidez#531)
1 parent 207255b commit 47ca956

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

resources/js/components/GraphqlMutation.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,14 @@ export default {
126126
if (!GraphQLError.prototype.isPrototypeOf(error)) {
127127
throw error
128128
}
129+
129130
const errorResponse = error.response.json()
130131
if (this.errorCallback) {
131132
await this.errorCallback(this.data, errorResponse)
132133
}
133134
135+
this.error = error.message
136+
134137
if (this.alert) {
135138
error.errors.forEach((error) => {
136139
Notify(error.message, 'error')
@@ -140,7 +143,7 @@ export default {
140143
return errorResponse
141144
})
142145
143-
if (response.data.errors) {
146+
if (response.errors) {
144147
return
145148
}
146149

0 commit comments

Comments
 (0)