Mark notification read when viewing the Bubble
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
record({ target, params: { url } }) {
|
||||
navigator.sendBeacon(url, this.#csrfPayload())
|
||||
target.remove()
|
||||
}
|
||||
|
||||
#csrfPayload() {
|
||||
const data = new FormData()
|
||||
data.append("authenticity_token", this.#csrfToken())
|
||||
return data
|
||||
}
|
||||
|
||||
#csrfToken() {
|
||||
return document.querySelector('meta[name="csrf-token"]').content
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
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" })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user