bill hace 3 años
padre
commit
e08a1752f1
Se han modificado 2 ficheros con 5 adiciones y 1 borrados
  1. 2 1
      src/api/instance.ts
  2. 3 0
      src/env/index.ts

+ 2 - 1
src/api/instance.ts

@@ -3,6 +3,7 @@ import { Message } from 'bill/index'
 import { showLoad, hideLoad } from '@/utils'
 import * as URL from './constant'
 import { ResCode, ResCodeDesc } from './constant'
+import { baseURL } from '@/env'
 
 const instance = axiosFactory()
 
@@ -53,6 +54,6 @@ addUnsetTokenURLS(
   URL.UPDATE_TAGGING_POINT,
   URL.DELETE_TAGGING_POINT,
 )
-setDefaultURI('/api')
+setDefaultURI(baseURL)
 
 export default axios

+ 3 - 0
src/env/index.ts

@@ -37,9 +37,12 @@ export type Params = {
   m: string,
   id: string,
   fushId: number,
+  baseURL?: string,
   token?: string
 }
 
+export const baseURL = params.baseURL ? params.baseURL : import.meta.env.DEV ? '/api' : ''
+
 
 export const getResource = (uri: string) => {
   if (~uri.indexOf('base64') || ~uri.indexOf('bolb') || ~uri.indexOf('//')) return uri