async updateSettings()

in src/report.ts [514:538]


  async updateSettings(settings: ISettings): Promise<IHttpPostMessageResponse<void>> {
    if (isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) {
      return Promise.reject(APINotSupportedForRDLError);
    }

    try {
      const response = await this.service.hpm.patch<void>('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow);

      // Update commands if provided
      const extension = settings?.extensions as IExtensions;
      this.commands = extension?.commands ?? this.commands;
      this.groups = extension?.groups ?? this.groups;

      // Adding commands in extensions array to this.commands
      const extensionsArray = settings?.extensions as IExtension[];
      if (Array.isArray(extensionsArray)) {
        this.commands = [];
        extensionsArray.map((extensionElement: IExtension) => { if (extensionElement?.command) { this.commands.push(extensionElement.command); } });
      }

      return response;
    } catch (response) {
      throw response.body;
    }
  }