From 05d84f16ae9ecd1249c7c6c8e25423e51384abce Mon Sep 17 00:00:00 2001 From: Pan Cake Date: Tue, 6 Feb 2024 20:00:40 +1000 Subject: [PATCH] support manifests responses with missing props --- src/components/Configuration.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/Configuration.vue b/src/components/Configuration.vue index 94d4a6a..0bcd748 100644 --- a/src/components/Configuration.vue +++ b/src/components/Configuration.vue @@ -81,6 +81,16 @@ function removeAddon(idx) { addons.value.splice(idx, 1) } + +function getNestedObjectProperty(obj, path, defaultValue = null) { + try { + console.log('path', path, 'obj', obj, 'defaultValue', defaultValue) + return path.split('.').reduce((acc, part) => acc && acc[part], obj) + } catch (e) { + return defaultValue + } +} +