Files
web/utils/contactConfig.ts
2024-04-29 14:02:03 +02:00

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]
}