Files
fizzy/app/javascript/controllers/beacon_controller.js
T
Kevin McConnell 42fa37d347 Send beacon request on disconnect as well
This is so we can dismiss any notifications that arrived for a bubble
while we were viewing that bubble. Otherwise, they'll stick around until
we leave the page and come back.
2025-01-21 14:47:56 +00:00

15 lines
325 B
JavaScript

import { post } from "@rails/request.js"
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = { url: String }
connect() {
post(this.urlValue, { responseKind: "turbo-stream" })
}
disconnect() {
post(this.urlValue, { responseKind: "turbo-stream" })
}
}