fix error display modal (#632)
This commit is contained in:
parent
1224b890db
commit
3d09f32078
|
|
@ -259,7 +259,7 @@ export default {
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error?.response?.status === 422) {
|
if (error?.response?.status === 422) {
|
||||||
this.validationErrorResponse = error.response.data
|
this.validationErrorResponse = error.data
|
||||||
this.showValidationErrors()
|
this.showValidationErrors()
|
||||||
} else {
|
} else {
|
||||||
useAlert().error(
|
useAlert().error(
|
||||||
|
|
@ -306,7 +306,7 @@ export default {
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error?.response?.status === 422) {
|
if (error?.response?.status === 422) {
|
||||||
this.validationErrorResponse = error.response
|
this.validationErrorResponse = error.data
|
||||||
this.showValidationErrors()
|
this.showValidationErrors()
|
||||||
} else {
|
} else {
|
||||||
useAlert().error(
|
useAlert().error(
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,21 @@
|
||||||
@close="$emit('close')"
|
@close="$emit('close')"
|
||||||
>
|
>
|
||||||
<div class="-mx-5">
|
<div class="-mx-5">
|
||||||
<h2 class="text-red-400 text-2xl font-bold mb-4 px-4">
|
<h2 class="text-red-600 text-2xl font-bold mb-4 px-4">
|
||||||
Error saving your form
|
Error saving your form
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="form.errors"
|
v-if="validationErrorResponse"
|
||||||
class="p-4 border-b border-t"
|
class="p-4 border-b border-t"
|
||||||
>
|
>
|
||||||
<p
|
<p
|
||||||
v-if="form.errors.message"
|
v-if="validationErrorResponse.message"
|
||||||
v-text="form.errors.message"
|
v-text="validationErrorResponse.message"
|
||||||
/>
|
/>
|
||||||
<ul class="list-disc list-inside">
|
<ul class="list-disc list-inside">
|
||||||
<li
|
<li
|
||||||
v-for="(err, key) in form.errors.errors"
|
v-for="(err, key) in validationErrorResponse.errors"
|
||||||
:key="key"
|
:key="key"
|
||||||
>
|
>
|
||||||
{{ Array.isArray(err) ? err[0] : err }}
|
{{ Array.isArray(err) ? err[0] : err }}
|
||||||
|
|
@ -41,17 +41,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "FormErrorModal",
|
name: 'FormErrorModal',
|
||||||
components: {},
|
|
||||||
props: {
|
props: {
|
||||||
show: { type: Boolean, required: true },
|
show: { type: Boolean, required: true },
|
||||||
form: { type: Object, required: false },
|
validationErrorResponse: { type: Object, required: false },
|
||||||
},
|
},
|
||||||
emits: ['close'],
|
emits: ['close'],
|
||||||
data: () => ({}),
|
|
||||||
|
|
||||||
computed: {},
|
|
||||||
|
|
||||||
methods: {},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue