fix(projects): fix proxy config
This commit is contained in:
parent
b546ff8625
commit
c8019c4ff7
@ -1,7 +1,7 @@
|
|||||||
# http url, prod environment
|
# backend service base url, prod environment
|
||||||
VITE_SERVICE_BASE_URL=https://mock.apifox.com/m1/3109515-0-default
|
VITE_SERVICE_BASE_URL=https://mock.apifox.com/m1/3109515-0-default
|
||||||
|
|
||||||
# http other url, prod environment
|
# other backend service base url, prod environment
|
||||||
VITE_OTHER_SERVICE_BASE_URL= `{
|
VITE_OTHER_SERVICE_BASE_URL= `{
|
||||||
"demo": "http://localhost:9529"
|
"demo": "http://localhost:9529"
|
||||||
}`
|
}`
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# http url, test environment
|
# backend service base url, test environment
|
||||||
VITE_SERVICE_BASE_URL=https://mock.apifox.com/m1/3109515-0-default
|
VITE_SERVICE_BASE_URL=https://mock.apifox.com/m1/3109515-0-default
|
||||||
|
|
||||||
# http other url, test environment
|
# other backend service base url, test environment
|
||||||
VITE_OTHER_SERVICE_BASE_URL= `{
|
VITE_OTHER_SERVICE_BASE_URL= `{
|
||||||
"demo": "http://localhost:9528"
|
"demo": "http://localhost:9528"
|
||||||
}`
|
}`
|
||||||
|
@ -7,7 +7,7 @@ import { createServiceConfig } from '../../src/utils/service';
|
|||||||
* @param env - The current env
|
* @param env - The current env
|
||||||
*/
|
*/
|
||||||
export function createViteProxy(env: Env.ImportMeta) {
|
export function createViteProxy(env: Env.ImportMeta) {
|
||||||
const isEnableHttpProxy = env.VITE_HTTP_PROXY === 'Y';
|
const isEnableHttpProxy = env.DEV && env.VITE_HTTP_PROXY === 'Y';
|
||||||
|
|
||||||
if (!isEnableHttpProxy) return undefined;
|
if (!isEnableHttpProxy) return undefined;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { BACKEND_ERROR_CODE, createFlatRequest, createRequest } from '@sa/axios'
|
|||||||
import { localStg } from '@/utils/storage';
|
import { localStg } from '@/utils/storage';
|
||||||
import { getServiceBaseURL } from '@/utils/service';
|
import { getServiceBaseURL } from '@/utils/service';
|
||||||
|
|
||||||
const isHttpProxy = import.meta.env.VITE_HTTP_PROXY === 'Y';
|
const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y';
|
||||||
const { baseURL, otherBaseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);
|
const { baseURL, otherBaseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);
|
||||||
|
|
||||||
export const request = createFlatRequest<App.Service.Response>(
|
export const request = createFlatRequest<App.Service.Response>(
|
||||||
|
Loading…
Reference in New Issue
Block a user