瀏覽代碼

Integrate config.js on the frontend

Kailash Nadh 5 年之前
父節點
當前提交
1bcd350b20
共有 4 個文件被更改,包括 13 次插入2 次删除
  1. 0 1
      admin.go
  2. 1 0
      frontend/public/index.html
  3. 11 0
      frontend/src/App.vue
  4. 1 1
      frontend/src/views/Campaign.vue

+ 0 - 1
admin.go

@@ -12,7 +12,6 @@ import (
 
 type configScript struct {
 	RootURL    string   `json:"rootURL"`
-	UploadURI  string   `json:"uploadURI"`
 	FromEmail  string   `json:"fromEmail"`
 	Messengers []string `json:"messengers"`
 }

+ 1 - 0
frontend/public/index.html

@@ -7,6 +7,7 @@
     <link rel="icon" href="<%= BASE_URL %>frontend/favicon.png" />
     <link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,600" rel="stylesheet" />
     <title><%= htmlWebpackPlugin.options.title %></title>
+    <script src="<%= BASE_URL %>api/config.js"></script>
   </head>
   <body>
     <noscript>

+ 11 - 0
frontend/src/App.vue

@@ -77,6 +77,16 @@
     <div class="main">
       <router-view :key="$route.fullPath" />
     </div>
+
+    <b-loading v-if="!isLoaded" active>
+        <div class="has-text-centered">
+          <h1 class="title">Oops</h1>
+          <p>
+            Can't connect to the listmonk backend.<br />
+            Make sure it is running and refresh this page.
+          </p>
+        </div>
+    </b-loading>
   </div>
 </template>
 
@@ -90,6 +100,7 @@ export default Vue.extend({
     return {
       activeItem: {},
       activeGroup: {},
+      isLoaded: window.CONFIG,
     };
   },
 

+ 1 - 1
frontend/src/views/Campaign.vue

@@ -159,7 +159,7 @@ export default Vue.extend({
       form: {
         name: '',
         subject: '',
-        fromEmail: '',
+        fromEmail: window.CONFIG.fromEmail,
         templateId: 0,
         lists: [],
         tags: [],