Browse Source

fix 修复 环境变量书写错误

疯狂的狮子Li 1 year ago
parent
commit
caa9d0fcdc
2 changed files with 2 additions and 1 deletions
  1. 1 0
      src/types/env.d.ts
  2. 1 1
      src/utils/websocket.ts

+ 1 - 0
src/types/env.d.ts

@@ -69,6 +69,7 @@ interface ImportMetaEnv {
   VITE_APP_ENV: string;
   VITE_APP_RSA_PUBLIC_KEY: string;
   VITE_APP_CLIENT_ID: string;
+  VITE_APP_WEBSOCKET: boolean;
 }
 interface ImportMeta {
   readonly env: ImportMetaEnv;

+ 1 - 1
src/utils/websocket.ts

@@ -33,7 +33,7 @@ let socketError = 0 as number; // 错误次数
 
 // 初始化socket
 export const initWebSocket = (url: any) => {
-  if (import.meta.env.VITE_APP_WEBSOCKET) {
+  if (!import.meta.env.VITE_APP_WEBSOCKET) {
     return;
   }
   socketUrl = url;