mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-05-02 12:07:02 +00:00
25 lines
790 B
TypeScript
25 lines
790 B
TypeScript
import type { LogSettings, SystemStatus } from 'types';
|
|
|
|
import { alovaInstance } from './endpoints';
|
|
|
|
// systemStatus - also used to ping in System Monitor for pinging
|
|
export const readSystemStatus = () =>
|
|
alovaInstance.Get<SystemStatus>('/rest/systemStatus');
|
|
|
|
// SystemLog
|
|
export const readLogSettings = () =>
|
|
alovaInstance.Get<LogSettings>('/rest/logSettings');
|
|
export const updateLogSettings = (data: LogSettings) =>
|
|
alovaInstance.Post('/rest/logSettings', data);
|
|
export const fetchLogES = () => alovaInstance.Get('/es/log');
|
|
|
|
const UPLOAD_TIMEOUT = 60000; // 1 minute
|
|
|
|
export const uploadFile = (file: File) => {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
return alovaInstance.Post('/rest/uploadFile', formData, {
|
|
timeout: UPLOAD_TIMEOUT
|
|
});
|
|
};
|