Default to empty obj

This commit is contained in:
shamoon
2025-03-16 19:38:55 -07:00
parent 10fa5d3c72
commit ac44b76624

View File

@@ -56,21 +56,22 @@ export async function cleanWidgetGroups(widgets) {
export async function getPrivateWidgetOptions(type, widgetIndex) { export async function getPrivateWidgetOptions(type, widgetIndex) {
const widgets = await widgetsFromConfig(); const widgets = await widgetsFromConfig();
const privateOptions = widgets.map((widget) => { const privateOptions =
const { index, url, username, password, key, apiKey } = widget.options; widgets.map((widget) => {
const { index, url, username, password, key, apiKey } = widget.options;
return { return {
type: widget.type, type: widget.type,
options: { options: {
index, index,
url, url,
username, username,
password, password,
key, key,
apiKey, apiKey,
}, },
}; };
}); }) || {};
return type !== undefined && widgetIndex !== undefined return type !== undefined && widgetIndex !== undefined
? privateOptions.find((o) => o.type === type && o.options.index === parseInt(widgetIndex, 10))?.options ? privateOptions.find((o) => o.type === type && o.options.index === parseInt(widgetIndex, 10))?.options