mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 13:33:40 +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;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataParsed) {
|
if (dataParsed && Object.entries(dataParsed).length) {
|
||||||
const validate = widgets[widget.type]?.mappings?.[endpoint]?.validate;
|
const validate = widgets[widget.type]?.mappings?.[endpoint]?.validate;
|
||||||
validate.forEach(key => {
|
validate?.forEach(key => {
|
||||||
if (dataParsed[key] === undefined) {
|
if (dataParsed[key] === undefined) {
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,7 @@ const widget = {
|
|||||||
endpoint: "series",
|
endpoint: "series",
|
||||||
map: (data) => ({
|
map: (data) => ({
|
||||||
total: asJson(data).length,
|
total: asJson(data).length,
|
||||||
}),
|
})
|
||||||
validate: [
|
|
||||||
"total"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
queue: {
|
queue: {
|
||||||
endpoint: "queue",
|
endpoint: "queue",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user