Remove duplicate code

This commit is contained in:
James 2019-09-24 09:20:51 -05:00 committed by GitHub
parent e33523e992
commit 9710d008f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,13 +51,6 @@
Accept: 'application/json',
'Content-Type': 'application/json'
};
var cookies = document.cookie.split(';').reduce((p, c) => {
let x = {};
let key = c.split('=')[0].trim();
x[key] = p[key] ? p[key].concat([c.split('=')[1]]) : [c.split('=')[1]];
return Object.assign(p, x);
}, {});
if (cookies.csrftoken && cookies.csrftoken.length) {
headers['X-CSRFToken'] = cookies.csrftoken.pop();
}