Browse Source

fix(jaas): Get dynamic branding url from config file

We make the request for dynamic branding as soon as possible so
at the time of the request the config is not yet added to the store.
In order to fix this we get the jass brandingDataUrl &
dynamicBrandingUrl directly from the config.
master
Vlad Piersec 3 years ago
parent
commit
ddcb85a1d8

+ 1
- 1
react/features/dynamic-branding/actions.js View File

@@ -27,7 +27,7 @@ export function fetchCustomBrandingData() {
27 27
         const { customizationReady } = state['features/dynamic-branding'];
28 28
 
29 29
         if (!customizationReady) {
30
-            const url = getDynamicBrandingUrl(state);
30
+            const url = await getDynamicBrandingUrl();
31 31
 
32 32
             if (url) {
33 33
                 try {

+ 5
- 4
react/features/dynamic-branding/functions.js View File

@@ -1,4 +1,5 @@
1 1
 // @flow
2
+import { loadConfig } from '../base/lib-jitsi-meet';
2 3
 
3 4
 /**
4 5
  * Extracts the fqn part from a path, where fqn represents
@@ -17,17 +18,17 @@ export function extractFqnFromPath() {
17 18
 /**
18 19
  * Returns the url used for fetching dynamic branding.
19 20
  *
20
- * @param {Object} state - The state of the app.
21 21
  * @returns {string}
22 22
  */
23
-export function getDynamicBrandingUrl(state: Object) {
24
-    const { dynamicBrandingUrl } = state['features/base/config'];
23
+export async function getDynamicBrandingUrl() {
24
+    const config = await loadConfig(window.location.href);
25
+    const { dynamicBrandingUrl } = config;
25 26
 
26 27
     if (dynamicBrandingUrl) {
27 28
         return dynamicBrandingUrl;
28 29
     }
29 30
 
30
-    const baseUrl = state['features/base/config'].brandingDataUrl;
31
+    const { brandingDataUrl: baseUrl } = config;
31 32
     const fqn = extractFqnFromPath();
32 33
 
33 34
     if (baseUrl && fqn) {

Loading…
Cancel
Save