feat: dnshole controls widget (#867)
* feat: dnshole controls widget * feat: add duration and timer modal * fix: code improvment * fix: add support for many integrations * fix: add support for more integrations * fix: move ControlsCard outside of main component * fix: deepsource
This commit is contained in:
27
packages/widgets/src/dns-hole/controls/serverData.ts
Normal file
27
packages/widgets/src/dns-hole/controls/serverData.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
"use server";
|
||||
|
||||
import { api } from "@homarr/api/server";
|
||||
|
||||
import type { WidgetProps } from "../../definition";
|
||||
|
||||
export default async function getServerDataAsync({ integrationIds }: WidgetProps<"dnsHoleSummary">) {
|
||||
if (integrationIds.length === 0) {
|
||||
return {
|
||||
initialData: [],
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const currentDns = await api.widget.dnsHole.summary({
|
||||
integrationIds,
|
||||
});
|
||||
|
||||
return {
|
||||
initialData: currentDns,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
initialData: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user