Skip to content

Commit 0086d5f

Browse files
committed
feat: added toasts
1 parent 56e3729 commit 0086d5f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

apps/backoffice-v2/public/locales/en/toast.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,8 @@
160160
"success": "Assessment status updated successfully.",
161161
"unexpected_error": "Something went wrong while updating the status of the assessment.",
162162
"error": "Error occurred while updating assessment status."
163+
},
164+
"common": {
165+
"unexpected_error": "Something went wrong. Please try again later."
163166
}
164167
}

apps/backoffice-v2/src/pages/Entity/components/Case/hooks/usePendingRevisionEvents/usePendingRevisionEvents.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { useCallback } from 'react';
33
import { buildCollectionFlowUrl, CommonWorkflowEvent } from '@ballerine/common';
44
import { checkIsKybExampleVariant } from '@/lib/blocks/variants/variant-checkers';
55
import { useRevisionCaseMutation } from '@/domains/workflows/hooks/mutations/useRevisionCaseMutation/useRevisionCaseMutation';
6+
import { toast } from 'sonner';
7+
import { t } from 'i18next';
68

79
export const usePendingRevisionEvents = ({
810
mutateRevisionCase,
@@ -14,7 +16,15 @@ export const usePendingRevisionEvents = ({
1416
documentIds: string[];
1517
}) => {
1618
const onMutateRevisionCase = useCallback(() => {
19+
if (!workflow) {
20+
console.error('Workflow not found.');
21+
toast.error(t('toast:common.unexpected_error'));
22+
return;
23+
}
24+
1725
if (!workflow?.nextEvents?.some(nextEvent => nextEvent === CommonWorkflowEvent.REVISION)) {
26+
console.error('Workflow does not have a revision event.');
27+
toast.error(t('toast:common.unexpected_error'));
1828
return;
1929
}
2030

@@ -23,6 +33,8 @@ export const usePendingRevisionEvents = ({
2333
const isKybExampleVariant = checkIsKybExampleVariant(workflow?.workflowDefinition);
2434

2535
if (!isKybExampleVariant) {
36+
console.error('Workflow is not a KYB example variant.');
37+
toast.error(t('toast:common.unexpected_error'));
2638
return;
2739
}
2840

0 commit comments

Comments
 (0)