mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-27 09:09:25 +03:00
31 lines
956 B
TypeScript
31 lines
956 B
TypeScript
import React, { Component } from 'react';
|
|
|
|
import { restController, RestControllerProps, RestFormLoader, SectionContent } from '../components';
|
|
import { ENDPOINT_ROOT } from '../api';
|
|
import EMSESPDevicesForm from './EMSESPDevicesForm';
|
|
import { EMSESPDevices } from './EMSESPtypes';
|
|
|
|
export const EMSESP_DEVICES_ENDPOINT = ENDPOINT_ROOT + "allDevices";
|
|
|
|
type EMSESPDevicesControllerProps = RestControllerProps<EMSESPDevices>;
|
|
|
|
class EMSESPDevicesController extends Component<EMSESPDevicesControllerProps> {
|
|
|
|
componentDidMount() {
|
|
this.props.loadData();
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<SectionContent title="Devices & Sensors">
|
|
<RestFormLoader
|
|
{...this.props}
|
|
render={formProps => <EMSESPDevicesForm {...formProps} />}
|
|
/>
|
|
</SectionContent>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default restController(EMSESP_DEVICES_ENDPOINT, EMSESPDevicesController);
|