2018-10-25 16:51:20 +02:00
|
|
|
/* eslint-disable
|
|
|
|
no-undef,
|
|
|
|
no-useless-escape,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
2018-11-21 11:08:53 +01:00
|
|
|
'use strict';
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2018-10-25 16:50:16 +02:00
|
|
|
Application.Services.service('CSRF', ['$cookies',
|
2018-10-25 16:51:20 +02:00
|
|
|
$cookies =>
|
2018-10-25 16:50:16 +02:00
|
|
|
({
|
2018-10-25 16:51:20 +02:00
|
|
|
setMetaTags () {
|
2018-10-25 16:50:16 +02:00
|
|
|
if (angular.element('meta[name="csrf-param"]').length === 0) {
|
2018-11-21 11:08:53 +01:00
|
|
|
angular.element('head').append('<meta name="csrf-param" content="authenticity_token">');
|
|
|
|
angular.element('head').append(`<meta name=\"csrf-token\" content=\"${$cookies['XSRF-TOKEN']}\">`);
|
2018-10-25 16:50:16 +02:00
|
|
|
} else {
|
2018-11-21 11:08:53 +01:00
|
|
|
angular.element('meta[name="csrf-token"]').replaceWith(`<meta name=\"csrf-token\" content=\"${$cookies['XSRF-TOKEN']}\">`);
|
2018-10-25 16:50:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2018-10-25 16:51:20 +02:00
|
|
|
|
2018-11-21 11:08:53 +01:00
|
|
|
]);
|