Sfoglia il codice sorgente

通过App构造接收地址,初始化连接到地址

HuangKai 1 settimana fa
parent
commit
37b79d5986
2 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 4 3
      src/model/AccountAuth.js
  2. 2 1
      src/view/App.js

+ 4 - 3
src/model/AccountAuth.js

@@ -5,9 +5,10 @@ import PubSub from 'pubsub-js';
 // const [fooEvents, setFooEvents] = useState([]);
 
 class AccountAuth {
-    constructor(){
-        const URL = '121.42.8.157:19702'
-        this._socket = io(URL, {
+    constructor(url){
+        // const URL = '121.42.8.157:19702'
+        // this._socket = io(URL, {
+        this._socket = io(url, {
             transports: ["websocket", "polling"],
             // path: '',
             autoConnect: true,

+ 2 - 1
src/view/App.js

@@ -19,6 +19,7 @@ export default class App {
 	constructor(params) {
 		this.el = params.el
 		this.id = params.id
+		this.url = params.url
 	}
 
 	init() {
@@ -110,7 +111,7 @@ export default class App {
 		// 	this.authWait = setInterval(this._checkAuth.bind(this), 100);
 		// }
 
-		window.editor_user_auth = new AccountAuth();
+		window.editor_user_auth = new AccountAuth(this.url);
 
 		/**
 		 * Event for logging in user