API: Remove unused CSRF token logic

This commit is contained in:
Alex Gleason 2020-06-09 14:45:48 -05:00
parent 95a9163883
commit 1b36699021
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -2,7 +2,6 @@
import axios from 'axios';
import LinkHeader from 'http-link-header';
import ready from './ready';
export const getLinks = response => {
const value = response.headers.link;
@ -14,17 +13,6 @@ export const getLinks = response => {
return LinkHeader.parse(value);
};
let csrfHeader = {};
function setCSRFHeader() {
const csrfToken = document.querySelector('meta[name=csrf-token]');
if (csrfToken) {
csrfHeader['X-CSRF-Token'] = csrfToken.content;
}
}
ready(setCSRFHeader);
const getToken = (getState, authType) =>
getState().getIn(['auth', authType, 'access_token']);
@ -32,7 +20,7 @@ export default (getState, authType = 'user') => {
const accessToken = getToken(getState, authType);
return axios.create({
headers: Object.assign(csrfHeader, accessToken ? {
headers: Object.assign(accessToken ? {
'Authorization': `Bearer ${accessToken}`,
} : {}),