device statistics load properly with context
This commit is contained in:
parent
24224e9225
commit
9041482131
1 changed files with 21 additions and 6 deletions
|
|
@ -211,12 +211,27 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
||||||
types?: string[]
|
types?: string[]
|
||||||
) => {
|
) => {
|
||||||
let url = pondURL("/deviceStatistics");
|
let url = pondURL("/deviceStatistics");
|
||||||
if (types && types.length > 0)
|
if (types && types.length > 0) {
|
||||||
url = pondURL(
|
url = pondURL(
|
||||||
"/deviceStatistics/" +
|
"/deviceStatistics/" +
|
||||||
(keys ? "?keys=" + keys.toString() : "") +
|
(keys ? "?keys=" + keys.toString() : "") +
|
||||||
(types ? "&types=" + types.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) => {
|
return new Promise<AxiosResponse<pond.GetDeviceStatisticsResponse>>((resolve, reject) => {
|
||||||
get<pond.GetDeviceStatisticsResponse>(url).then(resp => {
|
get<pond.GetDeviceStatisticsResponse>(url).then(resp => {
|
||||||
resp.data = pond.GetDeviceStatisticsResponse.fromObject(resp.data)
|
resp.data = pond.GetDeviceStatisticsResponse.fromObject(resp.data)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue