Skip to content

Commit

Permalink
values of code, cave, handle coming from configData
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaKhanAbdalli committed Jan 24, 2024
1 parent 01b2c73 commit 3e2392d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/resources/reference-data/ReferenceDataForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useFormContext } from 'react-hook-form'
import FlexBox from '../../components/FlexBox'
import { Modal, Typography } from '@mui/material'
import { Box } from '@mui/system'
import { useConfigData } from '../../utils/useConfigData'

const schema = yup.object({
name: yup.string().required()
Expand Down Expand Up @@ -218,16 +219,16 @@ const FormContent = ({
constants.R_CAT_HANDLE,
constants.R_DEPARTMENT
]

const configData = useConfigData()
const resourceName =
name === constants.R_DEPARTMENT
? 'department'
: name === constants.R_CAT_CODE
? 'code'
? configData?.catCode
: name === constants.R_CAT_CAVE
? 'cave'
? configData?.catCave
: name === constants.R_CAT_HANDLE
? 'handle'
? configData?.catHandle
: 'resource'
const warningTextForId = `Warning: Editing the id of a ${resourceName} that is in use may lead to data corruption. The id of a ${resourceName} must not be modified if data has been assigned to that ${resourceName}.`

Expand Down

0 comments on commit 3e2392d

Please sign in to comment.