📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
display i18n error message
Blue Mouse90f917ac0f05
diff --git a/public/locales/en.json b/public/locales/en.jsonindex 97fd4ff13..5a3a74216 100644--- a/public/locales/en.json+++ b/public/locales/en.json@@ -3,7 +3,10 @@"somethingWentWrong": "Something went wrong, please try again","emailRegistered": "A user with this email already exists","leakedPassword": "The provided password is leaked, please use another one",- "rateLimitHit": "Too many requests, please try again later"+ "rateLimitHit": "Too many requests, please try again later",+ "cancelSubFirst": "Please cancel your paid subscription first",+ "accountDeleted": "Your account has been deleted",+ "accountDeleteError": "Error while deleting your account"},"common": {"features": "Features",diff --git a/src/pages/UserSettings/UserSettings.container.jsx b/src/pages/UserSettings/UserSettings.container.jsxindex 4aa65afdc..af63ca04c 100644--- a/src/pages/UserSettings/UserSettings.container.jsx+++ b/src/pages/UserSettings/UserSettings.container.jsx@@ -29,9 +29,10 @@ const UserSettingsContainer = () => {dispatch(authActions.deleteAccountAsync((error) => dispatch(- errorsActions.deleteAccountFailed(error.description),+ errorsActions.deleteAccountFailed(error),),() => history.push(routes.main),+ t,))}diff --git a/src/redux/actions/auth/index.js b/src/redux/actions/auth/index.jsindex a9ece40ef..e6d490dad 100644--- a/src/redux/actions/auth/index.js+++ b/src/redux/actions/auth/index.js@@ -100,10 +100,12 @@ export const authActions = {}},- deleteAccountAsync(errorCallback, successCallback) {+ deleteAccountAsync(errorCallback, successCallback, t) {return {type: types.DELETE_ACCOUNT_ASYNC,- payload: { errorCallback, successCallback },+ payload: {+ errorCallback, successCallback, t,+ },}}}diff --git a/src/redux/sagas/auth/workers/deleteUserAccount.js b/src/redux/sagas/auth/workers/deleteUserAccount.jsindex 825203a78..1d1a09466 100644--- a/src/redux/sagas/auth/workers/deleteUserAccount.js+++ b/src/redux/sagas/auth/workers/deleteUserAccount.js@@ -4,14 +4,22 @@ import { authActions } from 'redux/actions/auth'import { alertsActions } from 'redux/actions/alerts'import { deleteUser } from 'api'-export default function* deleteUserAccountWorker({ payload: { errorCallback, successCallback } }) {+export default function* deleteUserAccountWorker({ payload: { errorCallback, successCallback, t } }) {try {yield call(deleteUser)yield call(successCallback)yield put(authActions.deleteAccountSuccess())- yield put(alertsActions.accountDeleted('Your account has been deleted'))- } catch (e) {- errorCallback(JSON.parse(e.message))+ yield put(alertsActions.accountDeleted(t('apiNotifications.accountDeleted')))+ } catch (error) {+ let message++ try {+ message = JSON.parse(error.message).message || 'somethingWentWrong'+ } catch (e) {+ message = 'somethingWentWrong'+ }++ errorCallback(t([`apiNotifications.${message}`, 'apiNotifications.somethingWentWrong']))} finally {yield put(authActions.finishLoading())}