alova - update comments

This commit is contained in:
proddy
2023-06-15 16:08:25 +02:00
parent adc4760b5f
commit f58dbf6ec1
20 changed files with 117 additions and 137 deletions

View File

@@ -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)) {