diff --git a/src/components/cards/AppInfoCard.tsx b/src/components/cards/AppInfoCard.tsx index 2631e65..d66b236 100644 --- a/src/components/cards/AppInfoCard.tsx +++ b/src/components/cards/AppInfoCard.tsx @@ -573,27 +573,35 @@ const AppInfoCard: React.FC = ({ return } - if (application.Lifecycle.State === 'ReadyToSign') { - const requestId = application['Allocation Requests'].find( - (alloc) => alloc.Active, - )?.ID - if (!requestId) return - + try { + if (application.Lifecycle.State === 'ReadyToSign') { + const requestId = application['Allocation Requests'].find( + (alloc) => alloc.Active, + )?.ID + if (!requestId) return + + setAllocationAmountConfig((prev) => ({ + ...prev, + isDialogOpen: false, + })) + + await mutationProposal.mutateAsync({ + requestId, + userName, + allocationAmount: validatedAllocationAmount, + }) + } else { + await mutationTrigger.mutateAsync({ + userName, + allocationAmount: validatedAllocationAmount, + }) + } + } catch (error) { setAllocationAmountConfig((prev) => ({ ...prev, isDialogOpen: false, })) - - await mutationProposal.mutateAsync({ - requestId, - userName, - allocationAmount: validatedAllocationAmount, - }) - } else { - await mutationTrigger.mutateAsync({ - userName, - allocationAmount: validatedAllocationAmount, - }) + handleSSAError(error) } setApiCalling(false) diff --git a/src/lib/apiClient.ts b/src/lib/apiClient.ts index bd1ac9b..442c749 100644 --- a/src/lib/apiClient.ts +++ b/src/lib/apiClient.ts @@ -175,6 +175,7 @@ export const postApplicationDecline = async ( return data } catch (error) { console.error(error) + throw error } } @@ -211,6 +212,7 @@ export const postAdditionalInfoRequest = async ( return data } catch (error) { console.error(error) + throw error } } @@ -262,6 +264,7 @@ export const postRequestKyc = async ( return data } catch (error) { console.error(error) + throw error } } @@ -287,6 +290,7 @@ export const postRemoveAlloc = async ( return data } catch (error) { console.error(error) + throw error } } @@ -322,6 +326,7 @@ export const postApplicationTrigger = async ( return data } catch (error) { console.error(error) + throw error } } @@ -354,6 +359,7 @@ export const postApproveChanges = async ( return data } catch (error) { console.error(error) + throw error } } @@ -401,6 +407,7 @@ export const postApplicationProposal = async ( return data } catch (error) { console.error(error) + throw error } } @@ -445,6 +452,7 @@ export const postApplicationApproval = async ( return data } catch (error) { console.error(error) + throw error } } @@ -462,6 +470,7 @@ export const fetchLDNActors = async (): Promise< return data } catch (e) { console.error(e) + throw e } } /**