diff --git a/app/assets/javascripts/base.js b/app/assets/javascripts/base.js index 6e7dd7ca..fc38d4a9 100644 --- a/app/assets/javascripts/base.js +++ b/app/assets/javascripts/base.js @@ -34,3 +34,9 @@ $.fn.replaceWithAndReturnNewElement = function(a) { // Disable the use of web workers for JStree due to JS error // See https://github.com/vakata/jstree/issues/1717 for details $.jstree.defaults.core.worker = false; + +// Update all CSRF tokens on the page to reduce InvalidAuthenticityToken errors +// See https://github.com/rails/jquery-ujs/issues/456 for details +$(document).on('turbolinks:load', function(){ + $.rails.refreshCSRFTokens(); +});