Browse Source

Добавлен eventCode в хедере

Vadim 3 months ago
parent
commit
5eb99f2639
3 changed files with 31 additions and 11 deletions
  1. 18 11
      index.html
  2. 6 0
      src/boot/axios.ts
  3. 7 0
      src/global.d.ts

+ 18 - 11
index.html

@@ -1,21 +1,28 @@
-<!DOCTYPE html>
+<!doctype html>
 <html>
   <head>
     <title><%= productName %></title>
 
-    <meta charset="utf-8">
-    <meta name="description" content="<%= productDescription %>">
-    <meta name="format-detection" content="telephone=no">
-    <meta name="msapplication-tap-highlight" content="no">
-    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
+    <meta charset="utf-8" />
+    <meta name="description" content="<%= productDescription %>" />
+    <meta name="format-detection" content="telephone=no" />
+    <meta name="msapplication-tap-highlight" content="no" />
+    <meta
+      name="viewport"
+      content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>"
+    />
 
-    <link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png">
-    <link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png">
-    <link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
-    <link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
-    <link rel="icon" type="image/ico" href="favicon.ico">
+    <link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png" />
+    <link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png" />
+    <link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png" />
+    <link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png" />
+    <link rel="icon" type="image/ico" href="favicon.ico" />
   </head>
   <body>
     <!-- quasar:entry-point -->
   </body>
+
+  <script>
+    window.eventCode = 'mstage';
+  </script>
 </html>

+ 6 - 0
src/boot/axios.ts

@@ -40,7 +40,13 @@ export default boot(({ router }) => {
       throw new Error('НЕ АВТОРИЗОВАН');
     }
 
+    if (!window.eventCode) {
+      console.error('Не инициализирован event-code');
+      throw new Error('Не инициализирован event-code');
+    }
+
     config.headers.Authorization = `Bearer ${accessToken}`;
+    config.headers['event-code'] = window.eventCode;
 
     Loading.show();
     return config;

+ 7 - 0
src/global.d.ts

@@ -0,0 +1,7 @@
+declare global {
+  interface Window {
+    eventCode: string;
+  }
+}
+
+export {};