constructor()

in authui-container/src/admin-ui.ts [164:196]


  constructor(container: string | HTMLElement, private readonly showToast: () => void) {
    this.httpClient = new HttpClient();
    this.containerElement = typeof container === 'string' ? document.querySelector(container) : container;
    if (!this.containerElement) {
      throw new Error(`Container element ${container} not found`);
    }
    this.loadingSpinnerElement = document.getElementById('loading-spinner');
    this.adminFormElement = getElementByClass('admin-form', this.containerElement) as HTMLElement;
    if (!this.adminFormElement) {
      throw new Error(`.admin-form element not found`);
    }
    this.reauthElement = getElementByClass('reauth', this.containerElement) as HTMLElement;
    if (!this.reauthElement) {
      throw new Error(`.reauth element not found`);
    }
    this.copyToClipboardElement = getElementByClass('copy-to-clipboard', this.containerElement) as HTMLElement;
    if (!this.copyToClipboardElement) {
      throw new Error(`.copy-to-clipboard element not found`);
    }
    this.textAreaElement = getElementByClass('config', this.containerElement) as HTMLTextAreaElement;
    if (!this.textAreaElement) {
      throw new Error(`.config element not found`);
    }
    // Alert elements.
    this.alertStatusElement = document.getElementById('alert-status');
    if (!this.alertStatusElement) {
      throw new Error(`#alert-status element not found`);
    }
    this.alertMessageElement = document.getElementById('alert-message');
    if (!this.alertMessageElement) {
      throw new Error(`#alert-message element not found`);
    }
  }