Skip to content

Commit

Permalink
Get the csrfToken from Blacklight.Core
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jan 31, 2023
1 parent d9f57df commit 2e2f92a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/javascript/controllers/tokens.js
Original file line number Diff line number Diff line change
@@ -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" ]
Expand All @@ -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 => {
Expand Down

0 comments on commit 2e2f92a

Please sign in to comment.