initial code

This commit is contained in:
2026-01-09 13:17:13 +07:00
commit d56d1c193b
68 changed files with 6529 additions and 0 deletions

View 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
View 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,
}