Skip to content

Commit

Permalink
fix: Search Email Regex move into Patterns file
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-nikunj committed Sep 24, 2024
1 parent 0e68030 commit 3730880
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/shared/frame/UserList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import type { TenantUser } from 'features/admin/userApiSlice'
import './style.scss'
import { setSearchInput } from 'features/appManagement/actions'
import { appManagementSelector } from 'features/appManagement/slice'
import Patterns from 'types/Patterns'

interface FetchHookArgsType {
appId?: string
Expand Down Expand Up @@ -87,7 +88,7 @@ export const UserList = ({
const searchInputData = useSelector(appManagementSelector)

const validateSearchText = (expr: string) => {
const validateExpr = /^[ A-Za-z0-9._!@+-]*$/.test(expr)
const validateExpr = Patterns.EMAIL_SEARCH.test(expr)
if (validateExpr) dispatch(setSearchInput({ open: true, text: expr }))
return validateExpr
}
Expand Down
1 change: 1 addition & 0 deletions src/types/Patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const Patterns = {
POSTAL_CODE:
/^(?!.*\s$)(?=[a-zA-Z\d-]{0,10}[-\s]?[a-zA-Z\d-]{0,10}$)[a-zA-Z\d\s-]{2,10}$/,
},
EMAIL_SEARCH: /^[ A-Za-z0-9._!@+-]*$/,
}

export const isEmpty = (expr: string) => !expr || expr.trim() === ''
Expand Down

0 comments on commit 3730880

Please sign in to comment.