Added response interceptor to transform 'x-xsrf-token' header into 'XSRF-TOKEN' cookie for cross-domain requests
This commit is contained in:
parent
a20a82cefd
commit
fc12285ad9
1 changed files with 7 additions and 0 deletions
|
|
@ -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)];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue