feat(dynamic-branding): get branding data from state

pull/11767/head jitsi-meet_7484
Calin-Teodor 2 years ago committed by Saúl Ibarra Corretgé
parent 21cf7f23c2
commit 6df2e4009c
  1. 2
      react/features/dynamic-branding/actions.any.js
  2. 3
      react/features/dynamic-branding/actions.native.js
  3. 10
      react/features/dynamic-branding/functions.any.js

@ -22,7 +22,7 @@ export function fetchCustomBrandingData() {
const { customizationReady } = state['features/dynamic-branding'];
if (!customizationReady) {
const url = await getDynamicBrandingUrl();
const url = await getDynamicBrandingUrl(state);
if (url) {
try {

@ -6,6 +6,7 @@ import {
setDynamicBrandingFailed,
setDynamicBrandingReady
} from './actions.any';
import { getDynamicBrandingUrl } from './functions.any';
import logger from './logger';
@ -19,7 +20,7 @@ import logger from './logger';
export function fetchCustomBrandingData() {
return async function(dispatch: Function, getState: Function) {
const state = getState();
const { dynamicBrandingUrl } = state['features/base/config'];
const dynamicBrandingUrl = await getDynamicBrandingUrl(state);
if (dynamicBrandingUrl) {
try {

@ -1,6 +1,7 @@
// @flow
import { loadConfig } from '../base/lib-jitsi-meet/functions';
import { toState } from '../base/redux';
/**
* Extracts the fqn part from a path, where fqn represents
@ -29,10 +30,13 @@ export function extractFqnFromPath(state?: Object) {
/**
* Returns the url used for fetching dynamic branding.
*
* @param {Object | Function} stateful - The redux store, state, or
* {@code getState} function.
* @returns {string}
*/
export async function getDynamicBrandingUrl() {
const config = await loadConfig(window.location.href);
export async function getDynamicBrandingUrl(stateful: Object | Function) {
const state = toState(stateful);
const config = state['features/base/config'];
const { dynamicBrandingUrl } = config;
if (dynamicBrandingUrl) {

Loading…
Cancel
Save