Browse Source

feat: added frontend config with backendUrl for socket.io

Kristian Vos 4 năm trước cách đây
mục cha
commit
72a2dd2d81
3 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 3 0
      frontend/dist/config/template.json
  2. 1 0
      frontend/dist/index.tpl.html
  3. 3 1
      frontend/main.js

+ 3 - 0
frontend/dist/config/template.json

@@ -0,0 +1,3 @@
+{
+	"backendUrl": "http://localhost:8080"
+}

+ 1 - 0
frontend/dist/index.tpl.html

@@ -6,6 +6,7 @@
     <!--script src="https://code.jquery.com/jquery-3.4.1.min.js"></script-->
 
     <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.dev.js" integrity="sha256-OgiHfllOBEOiWQ2OcBsDncRG2k7QBW9Rs1dB7MH2N2s=" crossorigin="anonymous"></script>
+    <script type='text/javascript' src='https://unpkg.com/lofig@1.2.1/dist/lofig.min.js'></script>
 
     <link href='https://fonts.googleapis.com/css?family=Roboto:100,400|Pacifico' rel='stylesheet'>
     <link href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet'>

+ 3 - 1
frontend/main.js

@@ -34,7 +34,9 @@ const router = new VueRouter({
 // 	next();
 // });
 
-io.init("http://localhost:8080");
+lofig.get("backendUrl").then(url => {
+	io.init(url);
+});
 
 new Vue({
 	router,