mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Change: Use the absence of "field" to refer to the root of customapi response
This commit is contained in:
@@ -57,8 +57,8 @@ widget:
|
||||
- field: key
|
||||
label: Number of things in array
|
||||
format: size
|
||||
- field: . # This will take the root of the API response, e.g. when APIs return an array
|
||||
label: Number of items
|
||||
# This (no field) will take the root of the API response, e.g. when APIs return an array:
|
||||
- label: Number of items
|
||||
format: size
|
||||
```
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ function getValue(field, data) {
|
||||
let key = "";
|
||||
|
||||
// Support APIs that return arrays or scalars directly.
|
||||
if (field === ".") {
|
||||
if (typeof field === "undefined") {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user