20 lines
423 B
TypeScript
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]
|
|
}
|
|
}
|