mod:调整环境配置文件

This commit is contained in:
zhangchuanlong 2022-02-09 17:46:25 +08:00
parent 823d718d7b
commit dd0c8a86c4
8 changed files with 18 additions and 32 deletions

View File

@ -1,18 +1,14 @@
NODE_ENV = 'development'
ENV = 'development'
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/'
# 是否使用MOCK
# 是否启用MOCK
VITE_APP_USE_MOCK = true
# proxy
VITE_PROXY = [["/api","http://localhost:8080"],["/api-test","localhost:8080"]]
# base api
# VITE_APP_GLOB_BASE_API = '/api'
VITE_APP_GLOB_BASE_API = '/api-mock'
VITE_APP_GLOB_BASE_API = '/api'
# test base api
VITE_APP_GLOB_BASE_API_TEST = '/api-test'

View File

@ -1,14 +1,11 @@
NODE_ENV = 'production'
ENV = 'production'
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/'
# 是否使用MOCK
# 是否启用MOCK
VITE_APP_USE_MOCK = true
# base api
VITE_APP_GLOB_BASE_API = '/api-mock'
VITE_APP_GLOB_BASE_API = '/api'
# test base api
VITE_APP_GLOB_BASE_API_TEST = '/api-test'

View File

@ -1,14 +1,11 @@
NODE_ENV = 'production'
ENV = 'staging'
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/'
# 是否使用MOCK
# 是否启用MOCK
VITE_APP_USE_MOCK = false
# base api
VITE_APP_GLOB_BASE_API = '/api-mock'
VITE_APP_GLOB_BASE_API = 'http://localhost:8080/api'
# test base api
VITE_APP_GLOB_BASE_API_TEST = '/api-test'
VITE_APP_GLOB_BASE_API_TEST = 'http://localhost:8080/api-test'

View File

@ -1,14 +1,10 @@
NODE_ENV = 'production'
ENV = 'test'
VITE_PUBLIC_PATH = '/'
# 是否使用MOCK
VITE_APP_USE_MOCK = false
# 是否启用MOCK
VITE_APP_USE_MOCK = true
# base api
VITE_APP_GLOB_BASE_API = '/api-mock'
VITE_APP_GLOB_BASE_API = '/api'
# test base api
VITE_APP_GLOB_BASE_API_TEST = '/api-test'

View File

@ -7,7 +7,7 @@ const token = {
export default [
{
url: '/api-mock/auth/login',
url: '/api/auth/login',
method: 'post',
response: ({ body }) => {
if (['admin', 'editor'].includes(body?.name)) {
@ -26,7 +26,7 @@ export default [
},
},
{
url: '/api-mock/auth/refreshToken',
url: '/api/auth/refreshToken',
method: 'post',
response: ({ headers }) => {
return {

View File

@ -24,7 +24,7 @@ const users = {
}
export default [
{
url: '/api-mock/user',
url: '/api/user',
method: 'get',
response: ({ headers }) => {
const token = resolveToken(headers?.authorization)

View File

@ -1,4 +1,4 @@
import { defAxios, mockAxios } from '@/utils/http'
import { defAxios } from '@/utils/http'
export function getUsers(data = {}) {
return defAxios({

View File

@ -13,6 +13,6 @@ function createAxios(option = {}) {
export const defAxios = createAxios()
export const mockAxios = createAxios({
export const testAxios = createAxios({
baseURL: window.__APP__GLOB__CONF__?.VITE_APP_GLOB_BASE_API_TEST || import.meta.env.VITE_APP_GLOB_BASE_API_TEST,
})