Browse Source

chore: 禁止核心环境变量暴露全局window

master
wangxiang 2 years ago
parent
commit
88c2b4080e
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 2
      src/api/platform/core/controller/user.ts
  2. 2
      src/utils/http/axios/index.ts

2
src/api/platform/core/controller/user.ts

@ -23,7 +23,7 @@ export const login = (params: LoginParams, options?: boolean | RequestOptions) = @@ -23,7 +23,7 @@ export const login = (params: LoginParams, options?: boolean | RequestOptions) =
// 非对称密钥AES加密处理
const user = encryptionLogin({
data: params,
key: import.meta.env.VITE_GATEWAY_ASE_ENCODE_SECRET,
key: import.meta.env['VITE_GATEWAY_ASE_ENCODE_SECRET'],
param: ['password']
});

2
src/utils/http/axios/index.ts

@ -108,7 +108,7 @@ const transform: AxiosTransform = { @@ -108,7 +108,7 @@ const transform: AxiosTransform = {
requestInterceptors: (config, options) => {
// 请求之前处理config
const token = getAccessToken();
const clientId = import.meta.env.VITE_CLIENT_ID, clientSecret = import.meta.env.VITE_CLIENT_SECRET;
const clientId = import.meta.env['VITE_CLIENT_ID'], clientSecret = import.meta.env['VITE_CLIENT_SECRET'];
const { clientId: customClientId , clientSecret: customClientSecret } = options?.requestOptions || {};
// 使用token进行请求
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {

Loading…
Cancel
Save