initial code
This commit is contained in:
11
src/repositories/device/index.ts
Normal file
11
src/repositories/device/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import api from "../../utils/axios";
|
||||
|
||||
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);
|
||||
return res.data;
|
||||
};
|
||||
46
src/repositories/device/types.d.ts
vendored
Normal file
46
src/repositories/device/types.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
type Device = {
|
||||
status: string;
|
||||
message: string;
|
||||
data: DeviceData;
|
||||
};
|
||||
|
||||
type DeviceData = {
|
||||
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;
|
||||
floorName: string;
|
||||
unitNumber: string;
|
||||
deviceName: string;
|
||||
roomName: string;
|
||||
deviceType: string;
|
||||
commandType: string;
|
||||
towerNumber: string;
|
||||
};
|
||||
|
||||
type DevicePayload = {
|
||||
commandType: string,
|
||||
deviceName: string,
|
||||
deviceType: string,
|
||||
floorName: string,
|
||||
merchantName: string,
|
||||
payload: {
|
||||
action: string
|
||||
},
|
||||
roomName: string,
|
||||
towerNumber: string,
|
||||
unitNumber: string,
|
||||
}
|
||||
Reference in New Issue
Block a user