mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-16 04:24:23 +00:00
17 lines
463 B
JavaScript
17 lines
463 B
JavaScript
import { Controller } from "stimulus";
|
|
|
|
export default class extends Controller {
|
|
static values = { url: String };
|
|
|
|
accept() {
|
|
const token = document.querySelector('meta[name="csrf-token"]').content;
|
|
// We don't really care if the update fails, if it fails it will result in the banner still
|
|
// being shown.
|
|
fetch(this.urlValue, { method: "post", headers: { "X-CSRF-Token": token } });
|
|
}
|
|
|
|
close_banner() {
|
|
this.element.remove();
|
|
}
|
|
}
|