on fetch submission data display error if there (#608)
Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
parent
ef12c82fe5
commit
2c8f7d5d54
|
|
@ -141,7 +141,14 @@ class PublicFormController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$submission = new FormSubmissionResource(FormSubmission::findOrFail($submissionId));
|
$submission = FormSubmission::find($submissionId);
|
||||||
|
if (!$submission) {
|
||||||
|
return $this->error([
|
||||||
|
'message' => 'Submission not found.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$submission = new FormSubmissionResource($submission);
|
||||||
$submission->publiclyAccessed();
|
$submission->publiclyAccessed();
|
||||||
|
|
||||||
if ($submission->form_id != $form->id) {
|
if ($submission->form_id != $form->id) {
|
||||||
|
|
|
||||||
|
|
@ -418,6 +418,9 @@ export default {
|
||||||
await this.recordsStore.loadRecord(
|
await this.recordsStore.loadRecord(
|
||||||
opnFetch('/forms/' + this.form.slug + '/submissions/' + this.form.submission_id).then((data) => {
|
opnFetch('/forms/' + this.form.slug + '/submissions/' + this.form.submission_id).then((data) => {
|
||||||
return {submission_id: this.form.submission_id, id: this.form.submission_id, ...data.data}
|
return {submission_id: this.form.submission_id, id: this.form.submission_id, ...data.data}
|
||||||
|
}).catch((error) => {
|
||||||
|
useAlert().error(error?.data?.message || 'Something went wrong')
|
||||||
|
return null
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return this.recordsStore.getByKey(this.form.submission_id)
|
return this.recordsStore.getByKey(this.form.submission_id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue