M: Improve token handling messages
This commit is contained in:
parent
17f30f0b20
commit
0dd8f850ba
|
|
@ -27,6 +27,11 @@ axiosInstance.interceptors.request.use(config => {
|
||||||
.split('; ')
|
.split('; ')
|
||||||
.find(row => row.startsWith('csrftoken='))
|
.find(row => row.startsWith('csrftoken='))
|
||||||
?.split('=')[1];
|
?.split('=')[1];
|
||||||
|
|
||||||
|
if (!token && config.method !== 'get') {
|
||||||
|
console.warn('CSRF token not found for non-GET request');
|
||||||
|
}
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
config.headers['x-csrftoken'] = token;
|
config.headers['x-csrftoken'] = token;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user