on fetch submission data display error if there (#608)

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala 2024-11-13 14:18:28 +05:30 committed by GitHub
parent ef12c82fe5
commit 2c8f7d5d54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -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();
if ($submission->form_id != $form->id) {

View File

@ -418,6 +418,9 @@ export default {
await this.recordsStore.loadRecord(
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}
}).catch((error) => {
useAlert().error(error?.data?.message || 'Something went wrong')
return null
})
)
return this.recordsStore.getByKey(this.form.submission_id)