diff --git a/packages/core/config/src/lib/constants/regex.ts b/packages/core/config/src/lib/constants/regex.ts index 043fbae7..2b36623c 100644 --- a/packages/core/config/src/lib/constants/regex.ts +++ b/packages/core/config/src/lib/constants/regex.ts @@ -5,14 +5,4 @@ export const REGEX: Readonly = { name: /^(?!.*([a-zA-ZäöüÄÖÜß0-9@_.-])\1)(?!.*([a-zA-ZäöüÄÖÜß0-9@_.-])\2)[a-zA-ZäöüÄÖÜß][a-zA-Z0-9äöüÄÖÜß@_.-]{7,19}[a-zA-Z0-9äöüÄÖÜß@_.-]$/, password: /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&])[A-Za-zd$@$!%*?&].{6,20}$/, - http: { - response: { - error: { - unknown: - /^Http failure response for (https?:\/\/[^\s]+): \d+ Unknown Error$/, - unauthorized: - /^Http failure response for (https?:\/\/[^\s]+): \d+ Unauthorized$/, - }, - }, - }, }; diff --git a/packages/core/state/src/lib/+state/app/app.reducer.ts b/packages/core/state/src/lib/+state/app/app.reducer.ts index c1a1ff6f..1193794f 100644 --- a/packages/core/state/src/lib/+state/app/app.reducer.ts +++ b/packages/core/state/src/lib/+state/app/app.reducer.ts @@ -4,10 +4,7 @@ import * as dayjs from 'dayjs'; import { STORE } from '@console-core/config'; import { EActionStatus, IAppState, INotification } from '@console-core/types'; -import { - capitalizeFirstLetter, - handleHttpResponseErrorContent, -} from '../../utils'; +import { capitalizeFirstLetter } from '../../utils'; import * as appActions from './app.actions'; @@ -24,9 +21,7 @@ const reducer = createReducer( const notification: INotification = { ...payload, title: capitalizeFirstLetter(payload.type), - content: capitalizeFirstLetter( - handleHttpResponseErrorContent(payload.content) - ), + content: capitalizeFirstLetter(payload.content), date: dayjs().toDate(), }; diff --git a/packages/core/state/src/lib/utils/http-response.ts b/packages/core/state/src/lib/utils/http-response.ts deleted file mode 100644 index d7e47679..00000000 --- a/packages/core/state/src/lib/utils/http-response.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { REGEX } from '@console-core/config'; - -export const handleHttpResponseErrorContent = (content: string): string => { - let newContent = content; - switch (true) { - case REGEX.http.response.error.unknown.test(content): - newContent = - 'We are having some temporary connection trouble. Please try again later.'; - break; - case REGEX.http.response.error.unauthorized.test(content): - newContent = 'Action not authorized.'; - break; - } - return newContent; -}; diff --git a/packages/core/state/src/lib/utils/index.ts b/packages/core/state/src/lib/utils/index.ts index 6273d562..5195e2d8 100644 --- a/packages/core/state/src/lib/utils/index.ts +++ b/packages/core/state/src/lib/utils/index.ts @@ -1,5 +1,5 @@ export * from './capitalize-first-letter'; export * from './rxjs-filters'; -export * from './http-response'; +export * from './operation-status'; export * from './state'; export * from './user';