Sha256: d3b8ffbe895acbbc1a2352692707484ed6117192de37cebe004251681b65925c

Contents?: true

Size: 878 Bytes

Versions: 1

Compression:

Stored size: 878 Bytes

Contents

import ApplicationController from "signum/controllers/application_controller"
import { post } from '@rails/request.js';

export default class extends ApplicationController {
  static targets = []
  static values = {
    signalId: String,
    signalState: String,
  }

  connect() {
    const niE = new CustomEvent("nd-item-activity", {
      bubbles: true,
      detail: "added",
    })
    window.dispatchEvent(niE)
    if (this.signalStateValue == "broadcasted") {
      this.showSignal()
    }
  }

  async showSignal() {
    try {
      const response = await post("/signal/show", {
        body: JSON.stringify({ id: this.signalIdValue }),
        contentType: 'application/json'
      });
      if (response.ok) {
      } else {
        console.error('Error: ', response.statusText);
      }
    } catch (error) {
      console.error('Request failed', error);
    }
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signum-0.7.8 app/components/signum/notification_drawer_item/component_controller.js