Homepage widget with totals, library, and watchlist mappings. Displays total entries, collections, favorites, library breakdown (movies/series), and watchlist breakdown (movies/series).
37 lines
993 B
JavaScript
37 lines
993 B
JavaScript
import { asJson } from "utils/proxy/api-helpers";
|
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
|
|
|
const widget = {
|
|
api: "{url}/api/v1/{endpoint}?token={dashboardToken}",
|
|
proxyHandler: genericProxyHandler,
|
|
|
|
mappings: {
|
|
totals: {
|
|
endpoint: "homepage-integration",
|
|
map: (data) => ({
|
|
totalEntries: asJson(data).totalEntries,
|
|
collections: asJson(data).collections,
|
|
favorits: asJson(data).favorits,
|
|
}),
|
|
},
|
|
library: {
|
|
endpoint: "homepage-integration",
|
|
map: (data) => ({
|
|
library: asJson(data).library,
|
|
libraryMovies: asJson(data).libraryMovies,
|
|
librarySeries: asJson(data).librarySeries,
|
|
}),
|
|
},
|
|
watchlist: {
|
|
endpoint: "homepage-integration",
|
|
map: (data) => ({
|
|
watchlist: asJson(data).watchlist,
|
|
watchlistMovies: asJson(data).watchlistMovies,
|
|
watchlistSeries: asJson(data).watchlistSeries,
|
|
}),
|
|
},
|
|
},
|
|
};
|
|
|
|
export default widget;
|