From 2e2f92aaeb3cf00371459c89fe2e2bbf82827d2c Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Tue, 31 Jan 2023 10:54:47 -0600 Subject: [PATCH] Get the csrfToken from Blacklight.Core --- app/javascript/controllers/tokens.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/tokens.js b/app/javascript/controllers/tokens.js index 6825d152c4..b76de0332f 100644 --- a/app/javascript/controllers/tokens.js +++ b/app/javascript/controllers/tokens.js @@ -1,4 +1,5 @@ import { Controller } from '@hotwired/stimulus' +import Blacklight from 'blacklight-frontend/app/assets/javascripts/blacklight/blacklight' export default class extends Controller { static targets = [ "output", "result", "button" ] @@ -7,7 +8,7 @@ export default class extends Controller { fetch(this.data.get("url"), { method: 'POST', headers: { - "X-CSRF-Token": Blacklight.csrfToken(), + "X-CSRF-Token": Blacklight.Core.csrfToken(), } }).then(response => response.text()) .then(token => {