interface: handle undefined group metadata correctly

This commit is contained in:
Liam Fitzgerald 2021-09-06 08:50:23 +10:00
parent 01aaeb7883
commit f28735316e

View File

@ -56,8 +56,11 @@ export function parentPath(path: string) {
* string -> enabled feed
*/
export function getFeedPath(association: Association): string | null | undefined {
const { metadata = { config: {} } } = association;
if (metadata.config && 'group' in metadata?.config && metadata.config?.group) {
const metadata = association?.metadata;
if(!metadata) {
return undefined;
}
if (metadata?.config && 'group' in metadata?.config && metadata.config?.group) {
if ('resource' in metadata.config.group) {
return metadata.config.group.resource;
}