Sfoglia il codice sorgente

add dashboardBasePath

visuddhinanda 2 anni fa
parent
commit
d1ecc18b80
1 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 9 0
      dashboard/src/utils.ts

+ 9 - 0
dashboard/src/utils.ts

@@ -1,6 +1,15 @@
 import { SortOrder } from "antd/lib/table/interface";
 import lodash from "lodash";
 
+export function dashboardBasePath(): string {
+  if (process.env.PUBLIC_URL.includes("http")) {
+    //for CDN
+    return process.env.PUBLIC_URL;
+  } else {
+    return window.location.origin + process.env.PUBLIC_URL;
+  }
+}
+
 export function fullUrl(url: string): string {
   if (process.env.PUBLIC_URL.includes("http")) {
     //for CDN