mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-18 08:12:10 +08:00
Default to empty obj
This commit is contained in:
@@ -56,7 +56,8 @@ 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 =
|
||||||
|
widgets.map((widget) => {
|
||||||
const { index, url, username, password, key, apiKey } = widget.options;
|
const { index, url, username, password, key, apiKey } = widget.options;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -70,7 +71,7 @@ export async function getPrivateWidgetOptions(type, widgetIndex) {
|
|||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user