修bug
This commit is contained in:
@@ -54,3 +54,42 @@ export const deleteDevice = (id) => {
|
||||
export const manualControlDevice = (id, manualControlData) => {
|
||||
return http.post(`/api/v1/devices/manual-control/${id}`, manualControlData);
|
||||
};
|
||||
|
||||
// AreaControllerApi 封装
|
||||
export const AreaControllerApi = {
|
||||
list: async () => {
|
||||
const response = await getDevices();
|
||||
return {
|
||||
...response,
|
||||
data: response.data.filter(device => device.type === 'area_controller')
|
||||
};
|
||||
},
|
||||
create: (deviceData) => {
|
||||
return createDevice({ ...deviceData, type: 'area_controller' });
|
||||
},
|
||||
getById: (id) => {
|
||||
return getDeviceById(id);
|
||||
},
|
||||
update: (id, deviceData) => {
|
||||
return updateDevice(id, { ...deviceData, type: 'area_controller' });
|
||||
},
|
||||
delete: (id) => {
|
||||
return deleteDevice(id);
|
||||
}
|
||||
};
|
||||
|
||||
// DeviceApi 封装
|
||||
export const DeviceApi = {
|
||||
create: (deviceData) => {
|
||||
return createDevice({ ...deviceData, type: 'device' });
|
||||
},
|
||||
getById: (id) => {
|
||||
return getDeviceById(id);
|
||||
},
|
||||
update: (id, deviceData) => {
|
||||
return updateDevice(id, { ...deviceData, type: 'device' });
|
||||
},
|
||||
delete: (id) => {
|
||||
return deleteDevice(id);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user