feat: add widgets
This commit is contained in:
1 parent
973baedfcb
commit
b902f93a3c
20 files changed
+323
-19
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { createIntegrationAsync } from "@homarr/integrations";
|
||||
import type { DawarichPlace, DawarichStatistics } from "@homarr/integrations";
|
||||
|
||||
import { createCachedIntegrationRequestHandler } from "./lib/cached-integration-request-handler";
|
||||
|
||||
export const dawarichStatisticsRequestHandler = createCachedIntegrationRequestHandler<
|
||||
DawarichStatistics,
|
||||
"dawarich",
|
||||
Record<string, never>
|
||||
>({
|
||||
async requestAsync(integration) {
|
||||
const instance = await createIntegrationAsync(integration);
|
||||
return await instance.getStatisticsAsync();
|
||||
},
|
||||
cacheDuration: dayjs.duration(5, "minutes"),
|
||||
queryKey: "dawarichStatistics",
|
||||
});
|
||||
|
||||
export const dawarichPlacesRequestHandler = createCachedIntegrationRequestHandler<
|
||||
DawarichPlace[],
|
||||
"dawarich",
|
||||
Record<string, never>
|
||||
>({
|
||||
async requestAsync(integration) {
|
||||
const instance = await createIntegrationAsync(integration);
|
||||
return await instance.getPlacesAsync();
|
||||
},
|
||||
cacheDuration: dayjs.duration(5, "minutes"),
|
||||
queryKey: "dawarichPlaces",
|
||||
});
|
||||
Reference in new issue
Block a user