mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
Alova 3 now working
This commit is contained in:
@@ -18,8 +18,7 @@ import {
|
||||
|
||||
import { readHardwareStatus, restart } from 'api/system';
|
||||
|
||||
// import { useRequest } from 'alova/client' // TODO replace when Alova 3 is released
|
||||
import { useRequest } from 'alova';
|
||||
import { useRequest } from 'alova/client';
|
||||
import RestartMonitor from 'app/status/RestartMonitor';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
import {
|
||||
@@ -82,15 +81,12 @@ const ApplicationSettings = () => {
|
||||
|
||||
const [fieldErrors, setFieldErrors] = useState<ValidateFieldsError>();
|
||||
|
||||
const {
|
||||
loading: processingBoard,
|
||||
send: readBoardProfile,
|
||||
onSuccess: onSuccessBoardProfile
|
||||
} = useRequest((boardProfile: string) => getBoardProfile(boardProfile), {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
onSuccessBoardProfile((event) => {
|
||||
const { loading: processingBoard, send: readBoardProfile } = useRequest(
|
||||
(boardProfile: string) => getBoardProfile(boardProfile),
|
||||
{
|
||||
immediate: false
|
||||
}
|
||||
).onSuccess((event) => {
|
||||
const response = event.data as Settings;
|
||||
updateDataValue({
|
||||
...data,
|
||||
@@ -107,29 +103,6 @@ const ApplicationSettings = () => {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO replace with Alova 3
|
||||
// const { loading: processingBoard, send: readBoardProfile } = useRequest(
|
||||
// (boardProfile: string) => getBoardProfile(boardProfile),
|
||||
// {
|
||||
// immediate: false
|
||||
// }
|
||||
// ).onSuccess((event) => {
|
||||
// const response = event.data as Settings;
|
||||
// updateDataValue({
|
||||
// ...data,
|
||||
// board_profile: response.board_profile,
|
||||
// led_gpio: response.led_gpio,
|
||||
// dallas_gpio: response.dallas_gpio,
|
||||
// rx_gpio: response.rx_gpio,
|
||||
// tx_gpio: response.tx_gpio,
|
||||
// pbutton_gpio: response.pbutton_gpio,
|
||||
// phy_type: response.phy_type,
|
||||
// eth_power: response.eth_power,
|
||||
// eth_phy_addr: response.eth_phy_addr,
|
||||
// eth_clock_mode: response.eth_clock_mode
|
||||
// });
|
||||
// });
|
||||
|
||||
const { send: restartCommand } = useRequest(restart(), {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user