Skip to content

Commit

Permalink
fix(app subscription): fix api error and validation (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhigarg-bmw authored Aug 31, 2023
1 parent ef04ad7 commit a7e6caa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '@catena-x/portal-shared-components'
import HelpOutlineIcon from '@mui/icons-material/HelpOutline'
import { useTranslation, Trans } from 'react-i18next'
import { isURL } from 'types/Patterns'
import { isKeycloakURL } from 'types/Patterns'
import CheckCircleOutlinedIcon from '@mui/icons-material/CheckCircleOutlined'
import {
SubscriptionActivationResponse,
Expand Down Expand Up @@ -86,7 +86,7 @@ const ActivateSubscriptionOverlay = ({
const addInputURL = (value: string) => {
setInputURL(value)
setURLErrorMessage(
!isURL(value.trim())
!isKeycloakURL(value.trim())
? t('content.appSubscription.pleaseEnterValidURL')
: ''
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export default function SubscriptionElements({
}}
/>
)}
{viewDetails && (
{viewDetails.appId && (
<AppSubscriptionDetailOverlay
openDialog={viewDetails.appId ? true : false}
appId={viewDetails.appId}
Expand Down
2 changes: 2 additions & 0 deletions src/types/Patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export const isMail = (expr: string) => Patterns.MAIL.test(expr)
export const isBPN = (expr: string) => Patterns.BPN.test(expr)
export const isDomain = (expr: string) => Patterns.DOMAIN.test(expr)
export const isURL = (expr: string) => Patterns.URL.test(expr)
export const isKeycloakURL = (expr: string) =>
isURL(expr) && !expr.includes('#')
export const isUUID = (expr: string) => Patterns.UUID.test(expr)
export const isCompanyName = (expr: string) => Patterns.COMPANY_NAME.test(expr)
export const isFirstName = (expr: string) => Patterns.firstName.test(expr)
Expand Down

0 comments on commit a7e6caa

Please sign in to comment.