device statistics load properly with context

This commit is contained in:
Carter 2025-05-07 13:27:37 -06:00
parent 24224e9225
commit 9041482131

View file

@ -211,12 +211,27 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
types?: string[]
) => {
let url = pondURL("/deviceStatistics");
if (types && types.length > 0)
if (types && types.length > 0) {
url = pondURL(
"/deviceStatistics/" +
(keys ? "?keys=" + keys.toString() : "") +
(types ? "&types=" + types.toString() : "")
)
if (!types.includes("team") && as.length > 0) {
url = pondURL(
"/deviceStatistics/" +
(keys ? "?keys=" + keys.toString() : "") +
(types ? "&types=" + types.toString() : "") +
("&as=" + as)
)
}
} else {
if (as.length > 0) {
url = pondURL(
"/deviceStatistics/?as=" + as
)
}
}
return new Promise<AxiosResponse<pond.GetDeviceStatisticsResponse>>((resolve, reject) => {
get<pond.GetDeviceStatisticsResponse>(url).then(resp => {
resp.data = pond.GetDeviceStatisticsResponse.fromObject(resp.data)