async connectedCallback()

in client/src/avocano-shell.js [78:122]


  async connectedCallback() {
    super.connectedCallback();

    const config = await getSiteConfig();
    // Show loading animation only when
    // site config is unavailable
    if (config) {
      if (config.errors) {
        // An error was encountered, pass it along to the UI.
        this.state.apiError = config.errors;

        //this.requestUpdate();
        //return;
      }
      this.state.loading = false;
    }

    if (config?.apiError) {
      // An error was encountered, pass it along to the UI.
      this.state.apiError = config.apiError;
    }

    // Set django site config properties as
    // global variables for our css to leverage
    this.style.setProperty('--color-primary', config.color_primary);
    this.style.setProperty('--color-secondary', config.color_secondary);
    this.style.setProperty('--color-action', config.color_action);
    this.style.setProperty('--color-action-text', config.color_action_text);
    this.style.setProperty('--site-name-color', config.site_name_color);
    this.style.setProperty('--site-name-font', config.site_name_font);
    this.style.setProperty('--base-font', config.base_font);

    this.state.config = config;

    /* Dynamically pull fonts we require */
    if (window.WebFont && config.base_font) {
      window.WebFont.load({
        google: {
          families: [config.base_font, config.site_name_font],
        },
      });
    }

    this.requestUpdate();
  }