mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
lint fixing
This commit is contained in:
@@ -145,7 +145,7 @@ const UploadDownload: FC = () => {
|
||||
onGetAPI((event) => {
|
||||
saveFile(
|
||||
event.data,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
|
||||
event.sendArgs[0].device + '_' + event.sendArgs[0].entity + '.txt'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -270,7 +270,7 @@ const Devices: FC = () => {
|
||||
async function onSelectChange(action: Action, state: State) {
|
||||
setSelectedDevice(state.id as number);
|
||||
if (action.type === 'ADD_BY_ID_EXCLUSIVELY') {
|
||||
await readDeviceData(state.id);
|
||||
await readDeviceData(state.id as number);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ const Devices: FC = () => {
|
||||
|
||||
const deviceValueDialogSave = async (devicevalue: DeviceValue) => {
|
||||
const id = Number(device_select.state.id);
|
||||
await writeDeviceValue({ id, c: devicevalue.c, v: devicevalue.v })
|
||||
await writeDeviceValue({ id, c: devicevalue.c ?? '', v: devicevalue.v })
|
||||
.then(() => {
|
||||
toast.success(LL.WRITE_CMD_SENT());
|
||||
})
|
||||
|
||||
@@ -45,7 +45,6 @@ const Help: FC = () => {
|
||||
);
|
||||
|
||||
anchor.download =
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
'emsesp_' + event.sendArgs[0].device + '_' + event.sendArgs[0].entity + '.txt';
|
||||
anchor.click();
|
||||
URL.revokeObjectURL(anchor.href);
|
||||
|
||||
@@ -49,7 +49,8 @@ const Modules: FC = () => {
|
||||
});
|
||||
|
||||
const { send: writeModules } = useRequest(
|
||||
(data: Modules) => EMSESP.writeModules(data),
|
||||
(data: { key: string; enabled: boolean; license: string }) =>
|
||||
EMSESP.writeModules(data),
|
||||
{
|
||||
immediate: false
|
||||
}
|
||||
@@ -145,7 +146,8 @@ const Modules: FC = () => {
|
||||
.catch((error: Error) => {
|
||||
toast.error(error.message);
|
||||
})
|
||||
.finally(() => {
|
||||
.finally(async () => {
|
||||
await fetchModules();
|
||||
setNumChanges(0);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -50,6 +50,7 @@ export const writeAnalogSensor = (as: WriteAnalogSensor) =>
|
||||
// Activity
|
||||
export const readActivity = () => alovaInstance.Get<Activity>('/rest/activity');
|
||||
|
||||
// Scan devices
|
||||
export const scanDevices = () => alovaInstance.Post('/rest/scanDevices');
|
||||
|
||||
// API, used in HelpInformation
|
||||
@@ -118,8 +119,11 @@ export const readModules = () =>
|
||||
}));
|
||||
}
|
||||
});
|
||||
export const writeModules = (data: Modules) =>
|
||||
alovaInstance.Post('/rest/modules', data);
|
||||
export const writeModules = (data: {
|
||||
key: string;
|
||||
enabled: boolean;
|
||||
license: string;
|
||||
}) => alovaInstance.Post('/rest/modules', data);
|
||||
|
||||
// SettingsEntities
|
||||
export const readCustomEntities = () =>
|
||||
|
||||
@@ -65,7 +65,7 @@ export const useRest = <D>({ read, update }: RestRequestOptions<D>) => {
|
||||
setErrorMessage(undefined);
|
||||
setDirtyFlags([]);
|
||||
setOrigData(data as D);
|
||||
await writeData(data).catch((error: Error) => {
|
||||
await writeData(data as D).catch((error: Error) => {
|
||||
if (error.message === 'Reboot required') {
|
||||
setRestartNeeded(true);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user