mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
alova - update comments
This commit is contained in:
@@ -4,23 +4,20 @@ import ReactHook from 'alova/react';
|
||||
import axios from 'axios';
|
||||
import { unpack } from '../api/unpack';
|
||||
|
||||
// TODO axios can be removed
|
||||
import type { AxiosPromise, CancelToken, AxiosProgressEvent } from 'axios';
|
||||
|
||||
export const REST_BASE_URL = '/rest/';
|
||||
export const API_BASE_URL = '/api/';
|
||||
|
||||
export const ACCESS_TOKEN = 'access_token';
|
||||
|
||||
const location = window.location;
|
||||
const webProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
export const WS_BASE_URL = '/ws/';
|
||||
export const ES_BASE_URL = '/es/';
|
||||
export const WEB_SOCKET_ROOT = webProtocol + '//' + location.host + WS_BASE_URL;
|
||||
export const EVENT_SOURCE_ROOT = location.protocol + '//' + location.host + ES_BASE_URL;
|
||||
const host = window.location.host;
|
||||
export const WEB_SOCKET_ROOT = 'ws://' + host + '/ws/';
|
||||
export const EVENT_SOURCE_ROOT = 'http://' + host + '/es/';
|
||||
|
||||
export const alovaInstance = createAlova({
|
||||
statesHook: ReactHook,
|
||||
timeout: 5000,
|
||||
timeout: 3000,
|
||||
requestAdapter: xhrRequestAdapter(),
|
||||
beforeRequest(method) {
|
||||
if (localStorage.getItem(ACCESS_TOKEN)) {
|
||||
|
||||
Reference in New Issue
Block a user