Added response interceptor to transform 'x-xsrf-token' header into 'XSRF-TOKEN' cookie for cross-domain requests

This commit is contained in:
Maurits van der Schee 2017-03-07 02:54:04 +01:00
commit fc12285ad9

View file

@ -141,6 +141,13 @@ var api = axios.create({
withCredentials: true
});
api.interceptors.response.use(function (response) {
if (response.headers['x-xsrf-token']) {
document.cookie = 'XSRF-TOKEN=' + response.headers['x-xsrf-token'] + '; path=/';
}
return response;
});
function findpost (postId) {
return posts[findpostKey(postId)];
};