Refactor stores for modularity and API type updates

- Split energy store into sensor, room, analytics, and websocket stores
- Add new analytics, room, sensor, and websocket stores - Update API
types for sensors (SensorDevice, SensorAction) - Update sensorsApi to
use new SensorDevice type - Add central index for store exports and
types - Refactor energy store to delegate to modular stores - Remove
legacy code and consolidate API logic
This commit is contained in:
rafaeldpsilva
2025-09-25 17:09:42 +01:00
parent 326746b5ef
commit 3299472c85
8 changed files with 1139 additions and 857 deletions

View File

@@ -1,6 +1,6 @@
import {
apiClient,
type SensorInfo,
type SensorDevice,
type SensorReading,
type DataQuery,
type DataResponse,
@@ -13,12 +13,12 @@ export const sensorsApi = {
room?: string
sensor_type?: SensorType
status?: SensorStatus
}): Promise<SensorInfo[]> {
return apiClient.get<SensorInfo[]>('/api/v1/sensors/get', params)
}): Promise<SensorDevice[]> {
return apiClient.get<SensorDevice[]>('/api/v1/sensors/get', params)
},
async getSensor(sensorId: string): Promise<SensorInfo> {
return apiClient.get<SensorInfo>(`/api/v1/sensors/${sensorId}`)
async getSensor(sensorId: string): Promise<SensorDevice> {
return apiClient.get<SensorDevice>(`/api/v1/sensors/${sensorId}`)
},
async getSensorData(