Skip to content

Commit

Permalink
try (#43)
Browse files Browse the repository at this point in the history
* Task #230243 fix code rabit issue

* Task #230243 fix height fix

* Task #230243 fix height, remove block not used change case

* Task #230243 fix try catch issue
  • Loading branch information
namita-25 authored Nov 29, 2024
1 parent ce8725c commit 155e2fd
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/screens/benefit/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,30 +97,30 @@ const BenefitsDetails: React.FC = () => {
const handleConfirmation = async () => {
setLoading(true);

try {
const result = await applyApplication({ id, context });
const url = (result as { data: { responses: Array<any> } }).data
?.responses?.[0]?.message?.order?.items?.[0]?.xinput?.form?.url;
const formData = authUser ?? undefined; // Ensure authUser is used or fallback to undefined

// Only set WebFormProps if the url exists
if (url) {
setWebFormProp({
url,
formData,
});
} else {
setError("URL not found in response");
}
} catch (error: unknown) {
if (error instanceof Error) {
setError(`Failed to apply application: ${error.message}`);
} else {
setError("An unknown error occurred");
}
} finally {
setLoading(false);
// try {
const result = await applyApplication({ id, context });
const url = (result as { data: { responses: Array<any> } }).data
?.responses?.[0]?.message?.order?.items?.[0]?.xinput?.form?.url;
const formData = authUser ?? undefined; // Ensure authUser is used or fallback to undefined
setLoading(false);
// Only set WebFormProps if the url exists
if (url) {
setWebFormProp({
url,
formData,
});
} else {
setError("URL not found in response");
}
// } catch (error: unknown) {
// if (error instanceof Error) {
// setError(`Failed to apply application: ${error.message}`);
// } else {
// setError("An unknown error occurred");
// }
// } finally {
// setLoading(false);
// }
};

const handleBack = () => {
Expand Down

0 comments on commit 155e2fd

Please sign in to comment.