mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-01 21:13:39 +01:00
fixes for widget validation
This commit is contained in:
parent
9d5e401fe2
commit
4ccf8eddae
@ -9,9 +9,9 @@ export default function validateWidgetData(widget, endpoint, data) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (dataParsed) {
|
||||
if (dataParsed && Object.entries(dataParsed).length) {
|
||||
const validate = widgets[widget.type]?.mappings?.[endpoint]?.validate;
|
||||
validate.forEach(key => {
|
||||
validate?.forEach(key => {
|
||||
if (dataParsed[key] === undefined) {
|
||||
valid = false;
|
||||
}
|
||||
|
@ -10,10 +10,7 @@ const widget = {
|
||||
endpoint: "series",
|
||||
map: (data) => ({
|
||||
total: asJson(data).length,
|
||||
}),
|
||||
validate: [
|
||||
"total"
|
||||
]
|
||||
})
|
||||
},
|
||||
queue: {
|
||||
endpoint: "queue",
|
||||
|
Loading…
x
Reference in New Issue
Block a user