chore(version): update version to 1.2.2 - dynamic api

This commit is contained in:
Tran Anh Tuan
2025-10-30 13:45:34 +07:00
parent ff66a95bc5
commit 92eb505cfc
6 changed files with 163 additions and 23 deletions

View File

@@ -1,4 +1,5 @@
import { ROUTE_LOGIN } from '@/constants';
import { apiConfig } from '@/services/ApiConfigService';
import { getToken, removeToken } from '@/utils/localStorageUtils';
import { history, RequestConfig } from '@umijs/max';
import { message } from 'antd';
@@ -84,9 +85,18 @@ export const handleRequestConfig: RequestConfig = {
// Request interceptors
requestInterceptors: [
(url: string, options: any) => {
console.log('URL Request:', url, options);
// Nếu URL không phải absolute URL, thêm base URL
let finalUrl = url;
if (!url.startsWith('http')) {
const baseUrl = apiConfig.getApiBaseUrl();
finalUrl = `${baseUrl}${url}`;
}
const token = getToken();
return {
url,
url: finalUrl,
options: {
...options,
headers: {