feat(topics) - add list topic
This commit is contained in:
@@ -1,11 +1,27 @@
|
||||
import { ENV } from "../../constants/env";
|
||||
import api from "../../utils/axios";
|
||||
import { basicAuth } from "../../utils/basic-auth";
|
||||
|
||||
export const getDeviceStatus = async (params: DeviceParams): Promise<Device> => {
|
||||
const res = await api.get('/device/v1/status', { params });
|
||||
export const getDeviceStatus = async (
|
||||
params: DeviceParams,
|
||||
): Promise<Device> => {
|
||||
const res = await api.get("/device/v1/status", { params });
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const postCommandStatus = async (payload: DevicePayload): Promise<Device> => {
|
||||
const res = await api.post('/device/v1/command', payload);
|
||||
export const postCommandStatus = async (
|
||||
payload: DevicePayload,
|
||||
): Promise<Device> => {
|
||||
const res = await api.post("/device/v1/command", payload);
|
||||
return res.data;
|
||||
};
|
||||
};
|
||||
|
||||
export const getTopicsState = async (): Promise<TopicData> => {
|
||||
const res = await api.get("/topics/v1/commands", {
|
||||
headers: {
|
||||
Authorization: basicAuth(ENV.basicUsername, ENV.basicPassword),
|
||||
},
|
||||
});
|
||||
|
||||
return res.data;
|
||||
};
|
||||
|
||||
60
src/repositories/device/types.d.ts
vendored
60
src/repositories/device/types.d.ts
vendored
@@ -5,21 +5,21 @@ type Device = {
|
||||
};
|
||||
|
||||
type DeviceData = {
|
||||
id?: string,
|
||||
floorName?: string;
|
||||
unitNumber?: string;
|
||||
deviceName?: string;
|
||||
roomName?: string;
|
||||
deviceType?: string;
|
||||
code?: string;
|
||||
towerNumber?: string;
|
||||
payload?: string;
|
||||
deviceLabel?: string
|
||||
deviceName?: string
|
||||
active?: boolean
|
||||
status?: boolean
|
||||
refetch?: () => void
|
||||
};
|
||||
id?: string;
|
||||
floorName?: string;
|
||||
unitNumber?: string;
|
||||
deviceName?: string;
|
||||
roomName?: string;
|
||||
deviceType?: string;
|
||||
code?: string;
|
||||
towerNumber?: string;
|
||||
payload?: string;
|
||||
deviceLabel?: string;
|
||||
deviceName?: string;
|
||||
active?: boolean;
|
||||
status?: boolean;
|
||||
refetch?: () => void;
|
||||
};
|
||||
|
||||
type DeviceParams = {
|
||||
merchantName?: string;
|
||||
@@ -33,15 +33,21 @@ type DeviceParams = {
|
||||
};
|
||||
|
||||
type DevicePayload = {
|
||||
commandType?: string,
|
||||
deviceName?: string,
|
||||
deviceType?: string,
|
||||
floorName?: string,
|
||||
merchantName?: string,
|
||||
payload?: {
|
||||
action?: string
|
||||
},
|
||||
roomName?: string,
|
||||
towerNumber?: string,
|
||||
unitNumber?: string,
|
||||
}
|
||||
commandType?: string;
|
||||
deviceName?: string;
|
||||
deviceType?: string;
|
||||
floorName?: string;
|
||||
merchantName?: string;
|
||||
payload?: {
|
||||
action?: string;
|
||||
};
|
||||
roomName?: string;
|
||||
towerNumber?: string;
|
||||
unitNumber?: string;
|
||||
};
|
||||
|
||||
type TopicData = {
|
||||
status: string;
|
||||
message: string;
|
||||
data: { topic: string }[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user