Skip to content

Commit ea7dd4b

Browse files
committed
fix notification error due to deletion of account creation
1 parent fd9cc65 commit ea7dd4b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

daikoku/javascript/src/components/backoffice/notifications/NotificationList.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ type NotificationActionGQL =
179179
}
180180
| {
181181
__typename: 'AccountCreationAttempt';
182-
demand: IAccountCreationGQL;
182+
demand?: IAccountCreationGQL;
183183
motivation: string;
184184
};
185185

@@ -921,21 +921,21 @@ export const NotificationList = () => {
921921
return translate('notif.subscription.transfer.success')
922922
case 'AccountCreationAttempt':
923923
const description = translate('notif.account.creation.attempt');
924-
const value = notification.action.demand.value
925-
const formStep = notification.action.demand.steps.map(s => s.step).find(s => s.type === 'form')
924+
const value = notification.action.demand?.value
925+
const formStep = notification.action.demand?.steps.map(s => s.step).find(s => s.type === 'form')
926926

927927
const regexp = /\[\[(.+?)\]\]/g;
928928
const matches = formStep?.formatter.match(regexp);
929929

930930
const formattedValue = matches?.reduce((acc, match) => {
931931
const key = match.replace('[[', '').replace(']]', '');
932-
return acc.replace(match, value[key] || match);
932+
return acc.replace(match, value?.[key] || match);
933933
}, formStep?.formatter ?? "");
934934

935935
return (
936936
<>
937937
{description}
938-
<a
938+
{value && <a
939939
href='#'
940940
className='underline'
941941
aria-label={translate('notifications.page.account.creation.attempt.detail.button.label')}
@@ -950,7 +950,7 @@ export const NotificationList = () => {
950950
</div>
951951
})}>
952952
<span className='ms-2'>[{translate('notifications.page.account.creation.attempt.detail.button.label')}]</span>
953-
</a>
953+
</a>}
954954
</>
955955
)
956956
default:

0 commit comments

Comments
 (0)