Skip to content

Commit

Permalink
⚰️ [open-formulieren/open-forms#4929] Delete dead code
Browse files Browse the repository at this point in the history
The error handling of the post method is obsoleted because the apiCall
helper itself already calls throwForStatus which results in an
exception if/when response.ok is false, so this block of code will
never execute.

This also further simplifies the helper to directly return the status
URL, which is the only bit of relevant information returned by the
API endpoint.
  • Loading branch information
sergei-maertens committed Jan 18, 2025
1 parent f5da831 commit 4644a93
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/components/Summary/SubmissionSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ import {loadSummaryData} from './utils';

const completeSubmission = async (submission, statementValues) => {
const response = await post(`${submission.url}/_complete`, statementValues);
if (!response.ok) {
console.error(response.data);
// TODO Specific error for each type of invalid data?
throw new Error('InvalidSubmissionData');
} else {
return response.data;
}
const {statusUrl} = response.data;
return statusUrl;
};

const SubmissionSummary = () => {
Expand Down Expand Up @@ -59,8 +54,7 @@ const SubmissionSummary = () => {
if (refreshedSubmission.submissionAllowed !== SUBMISSION_ALLOWED.yes) return;
let statusUrl;
try {
const responseData = await completeSubmission(refreshedSubmission, statementValues);
statusUrl = responseData.statusUrl;
statusUrl = await completeSubmission(refreshedSubmission, statementValues);
} catch (e) {
setSubmitError(e.message);
return;
Expand Down

0 comments on commit 4644a93

Please sign in to comment.