diff --git a/login-workflow/CHANGELOG.md b/login-workflow/CHANGELOG.md index bb23ec46..bc0e8197 100644 --- a/login-workflow/CHANGELOG.md +++ b/login-workflow/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Translations not working while throwing error from actions ([#513](https://github.com/etn-ccis/blui-react-workflows/issues/513)). +- Error in the dialog / message box does not translate ([#510](https://github.com/etn-ccis/blui-react-workflows/issues/510)). +- Title missing in the messageBoxConfig of ErrorManager ([#507](https://github.com/etn-ccis/blui-react-workflows/issues/507)). - Added loader to the login action ([#511](https://github.com/etn-ccis/blui-react-workflows/issues/511)). ## v4.0.0 (October 4, 2023) diff --git a/login-workflow/example/src/actions/AuthUIActions.tsx b/login-workflow/example/src/actions/AuthUIActions.tsx index bb8d9dcd..f55036d9 100644 --- a/login-workflow/example/src/actions/AuthUIActions.tsx +++ b/login-workflow/example/src/actions/AuthUIActions.tsx @@ -90,7 +90,7 @@ export const ProjectAuthUIActions: AuthUIActionsWithApp = (appHelper) => ({ if (isRandomFailure()) { // reject(new Error('LOGIN.GENERIC_ERROR')); - throw new Error('LOGIN.INVALID_CREDENTIALS'); + throw new Error('bluiAuth:LOGIN.INVALID_CREDENTIALS'); } LocalStorage.saveAuthCredentials(email, email); diff --git a/login-workflow/src/components/Error/ErrorManager.tsx b/login-workflow/src/components/Error/ErrorManager.tsx index 1f4f6648..2254de15 100644 --- a/login-workflow/src/components/Error/ErrorManager.tsx +++ b/login-workflow/src/components/Error/ErrorManager.tsx @@ -33,6 +33,7 @@ export type ErrorManagerProps = { dismissLabel?: string; }; messageBoxConfig?: { + title?: string; dismissible?: boolean; position?: 'top' | 'bottom'; fontColor?: string; @@ -79,7 +80,7 @@ const ErrorManager: React.FC = (props): JSX.Element => { 0} title={dialogConfig?.title ?? t('bluiCommon:MESSAGES.ERROR')} - body={error} + body={t(error)} onClose={onClose} dismissButtonText={dialogConfig?.dismissLabel} /> @@ -92,7 +93,8 @@ const ErrorManager: React.FC = (props): JSX.Element => { return ( { - const { errorMessage, backgroundColor, dismissible = true, fontColor, onClose = (): void => {}, sx } = props; + const { title, errorMessage, backgroundColor, dismissible = true, fontColor, onClose = (): void => {}, sx } = props; return ( { }} /> )} - {errorMessage} + + {title} + {errorMessage} + ); }; diff --git a/login-workflow/src/contexts/ErrorContext/useErrorManager.tsx b/login-workflow/src/contexts/ErrorContext/useErrorManager.tsx index 517e285c..23500bff 100644 --- a/login-workflow/src/contexts/ErrorContext/useErrorManager.tsx +++ b/login-workflow/src/contexts/ErrorContext/useErrorManager.tsx @@ -24,7 +24,6 @@ export const useErrorManager = (): { } return { ...errorConfig, - dialogConfig: { title: 'Error' }, error: err.message, onClose: (): void => { setError(new Error());