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

20 lines
423 B
TypeScript

import {
ContactConfig,
ContactFieldGroups,
} from "@/types/requests/contactConfig"
export function getValueFromContactConfig(
keyString: string,
data: ContactConfig
): string | undefined {
const [groupName, key] = keyString.split(".") as [
ContactFieldGroups,
keyof ContactConfig[ContactFieldGroups],
]
if (data[groupName]) {
const fieldGroup = data[groupName]
return fieldGroup[key]
}
}