1
0
mirror of https://github.com/karl0ss/homepage.git synced 2025-05-19 21:06:19 +01:00

20 lines
516 B
JavaScript
Raw Normal View History

2022-12-16 22:33:15 -08:00
import { asJson } from "utils/proxy/api-helpers";
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
2022-12-06 21:33:45 +08:00
const widget = {
2022-12-16 22:33:15 -08:00
api: "{url}/v1/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
counters: {
endpoint: "feeds/counters",
map: (data) => ({
read: Object.values(asJson(data).reads).reduce((acc, i) => acc + i, 0),
unread: Object.values(asJson(data).unreads).reduce((acc, i) => acc + i, 0)
}),
},
}
2022-12-06 21:33:45 +08:00
};
export default widget;