Skip to content

Commit f8487db

Browse files
committed
updated to use ReactOnRails.authenticityHeaders() from gem v6.1
1 parent 44a37cd commit f8487db

File tree

7 files changed

+115
-130
lines changed

7 files changed

+115
-130
lines changed

Diff for: Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ gem "sdoc", group: :doc
4141
# Use Rails Html Sanitizer for HTML sanitization
4242
gem "rails-html-sanitizer"
4343

44-
gem "react_on_rails", "~> 6"
44+
gem "react_on_rails", "~> 6.1"
4545

4646
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
4747
# mini_racer is probably faster than therubyracer

Diff for: Gemfile.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ GEM
205205
ffi (>= 0.5.0)
206206
rdoc (4.2.2)
207207
json (~> 1.4)
208-
react_on_rails (6.0.5)
208+
react_on_rails (6.1.0)
209209
addressable
210210
connection_pool
211211
execjs (~> 2.5)
@@ -336,7 +336,7 @@ DEPENDENCIES
336336
rails-html-sanitizer
337337
rails_12factor
338338
rainbow
339-
react_on_rails (~> 6)
339+
react_on_rails (~> 6.1)
340340
rspec-rails (= 3.5.0.beta3)
341341
rspec-retry
342342
rubocop
@@ -355,4 +355,4 @@ RUBY VERSION
355355
ruby 2.3.1p112
356356

357357
BUNDLED WITH
358-
1.12.3
358+
1.12.5

Diff for: client/app/bundles/comments/components/SimpleCommentScreen/SimpleCommentScreen.jsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react';
22
import Immutable from 'immutable';
33
import request from 'axios';
4-
import _ from 'lodash';
4+
import ReactOnRails from 'react-on-rails';
55

66
import BaseComponent from 'libs/components/BaseComponent';
7-
import metaTagsManager from 'libs/metaTagsManager';
87

98
import CommentForm from '../CommentBox/CommentForm/CommentForm';
109
import CommentList from '../CommentBox/CommentList/CommentList';
@@ -41,9 +40,7 @@ export default class SimpleCommentScreen extends BaseComponent {
4140

4241
const requestConfig = {
4342
responseType: 'json',
44-
headers: {
45-
'X-CSRF-Token': metaTagsManager.getCSRFToken(),
46-
},
43+
headers: ReactOnRails.authenticityHeaders(),
4744
};
4845

4946
return (

Diff for: client/app/libs/metaTagsManager.js

-15
This file was deleted.

Diff for: client/app/libs/requestsManager.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import request from 'axios';
2-
import metaTagsManager from './metaTagsManager';
2+
import ReactOnRails from 'react-on-rails';
33

44
const API_URL = 'comments.json';
55

@@ -29,9 +29,7 @@ export default {
2929
method: 'POST',
3030
url: API_URL,
3131
responseType: 'json',
32-
headers: {
33-
'X-CSRF-Token': metaTagsManager.getCSRFToken(),
34-
},
32+
headers: ReactOnRails.authenticityHeaders(),
3533
data: entity,
3634
});
3735
},

0 commit comments

Comments
 (0)