In Vue.js project, how can I get the csrftoken
?
I tried use js-cookie
, but can not get it:
import Cookies from 'js-cookie';
if (Cookies.get('csrftoken')!==undefined) { // there will skip, because the Cookies.get('csrftoken') is undefined.
config.headers['x-csrftoken']= Cookies.get('csrftoken'); // 'CSRFToken '
}
but I can get other cookie.
EDIT
Cookies.get('csrftoken')
this code get undefined
.
But when I access, there is the csrftoken
.