19 lines
426 B
TypeScript
19 lines
426 B
TypeScript
import {
|
|
ContactConfig,
|
|
ContactConfigField,
|
|
ContactFieldGroups,
|
|
} from "@/types/requests/contactConfig"
|
|
|
|
export function getValueFromContactConfig(
|
|
keyStrings: ContactConfigField,
|
|
data: ContactConfig
|
|
): string | undefined {
|
|
const [groupName, key] = keyStrings.split(".") as [
|
|
ContactFieldGroups,
|
|
keyof ContactConfig[ContactFieldGroups],
|
|
]
|
|
const fieldGroup = data[groupName]
|
|
|
|
return fieldGroup[key]
|
|
}
|