sending device state as a field contains instead of a search field
This commit is contained in:
parent
871cbf424e
commit
3732d76156
3 changed files with 23 additions and 13 deletions
|
|
@ -8,7 +8,7 @@ import { AxiosResponse } from "axios";
|
|||
import { useGlobalState } from "providers";
|
||||
import moment from "moment";
|
||||
import { or } from "utils/types";
|
||||
import { reject, result } from "lodash";
|
||||
// import { reject, result } from "lodash";
|
||||
|
||||
export interface IDeviceAPIContext {
|
||||
add: (name: string, description: string, backpack: pond.BackpackSettings) => Promise<AxiosResponse<pond.AddDeviceResponse>>;
|
||||
|
|
@ -36,7 +36,8 @@ export interface IDeviceAPIContext {
|
|||
comprehensive?: boolean,
|
||||
withMeasurements?: boolean,
|
||||
keys?: string[],
|
||||
types?: string[]
|
||||
types?: string[],
|
||||
fieldContains?: Map<string, string>,
|
||||
) => Promise<AxiosResponse<pond.ListDevicesResponse>>;
|
||||
listForUser: (
|
||||
asRoot: boolean,
|
||||
|
|
@ -302,7 +303,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
comprehensive?: boolean,
|
||||
withMeasurements?: boolean,
|
||||
keys?: string[],
|
||||
types?: string[]
|
||||
types?: string[],
|
||||
fieldContains?: Map<string, string>,
|
||||
) => {
|
||||
const url = pondURL(
|
||||
"/devices" +
|
||||
|
|
@ -321,7 +323,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
(comprehensive ? "&comprehensive=" + comprehensive.toString() : "") +
|
||||
(withMeasurements ? "&measurements=" + withMeasurements.toString() : "") +
|
||||
(keys ? "&keys=" + keys.toString() : "") +
|
||||
(types ? "&types=" + types.toString() : "")
|
||||
(types ? "&types=" + types.toString() : "") +
|
||||
(fieldContains ? "&fieldContains=" + JSON.stringify(Object.fromEntries(fieldContains)) : "")
|
||||
);
|
||||
return new Promise<AxiosResponse<pond.ListDevicesResponse>>((resolve, reject)=>{
|
||||
get<pond.ListDevicesResponse>(url).then(resp => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue