mirror of
https://github.com/ajnart/homarr.git
synced 2026-03-01 18:00:55 +01:00
Co-authored-by: SeDemal <Tagaishi@hotmail.ch> Co-authored-by: SeDemal <demal.sebastien@bluewin.ch> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
26 lines
514 B
TypeScript
26 lines
514 B
TypeScript
"use server";
|
|
|
|
import { api } from "@homarr/api/server";
|
|
|
|
import type { WidgetProps } from "../../definition";
|
|
|
|
export default async function getServerDataAsync({
|
|
integrationIds,
|
|
itemId,
|
|
}: WidgetProps<"mediaRequests-requestStats">) {
|
|
if (integrationIds.length === 0 || !itemId) {
|
|
return {
|
|
initialData: undefined,
|
|
};
|
|
}
|
|
|
|
const stats = await api.widget.mediaRequests.getStats({
|
|
integrationIds,
|
|
itemId,
|
|
});
|
|
|
|
return {
|
|
initialData: stats.filter((group) => group != null),
|
|
};
|
|
}
|