|
|
|
@ -19,6 +19,9 @@
|
|
|
|
Axios.defaults.headers.patch['X-CSRFToken'] = header;
|
|
|
|
Axios.defaults.headers.patch['X-CSRFToken'] = header;
|
|
|
|
Axios.defaults.headers.post['X-CSRFToken'] = header;
|
|
|
|
Axios.defaults.headers.post['X-CSRFToken'] = header;
|
|
|
|
Axios.defaults.headers.put['X-CSRFToken'] = header;
|
|
|
|
Axios.defaults.headers.put['X-CSRFToken'] = header;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Allows to move authentification headers to backend
|
|
|
|
|
|
|
|
Axios.defaults.withCredentials = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function about() {
|
|
|
|
async function about() {
|
|
|
|
@ -98,7 +101,12 @@
|
|
|
|
Axios.defaults.headers.common.Cookie = cookies;
|
|
|
|
Axios.defaults.headers.common.Cookie = cookies;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Browser code. We need set additinal header for authentification
|
|
|
|
// Browser code. We need set additinal header for authentification
|
|
|
|
const csrftoken = Cookie.get('csrftoken');
|
|
|
|
let csrftoken = response.data.csrf;
|
|
|
|
|
|
|
|
if (csrftoken) {
|
|
|
|
|
|
|
|
setCSRFHeader(csrftoken);
|
|
|
|
|
|
|
|
Cookie.set('csrftoken', csrftoken);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
csrftoken = Cookie.get('csrftoken');
|
|
|
|
if (csrftoken) {
|
|
|
|
if (csrftoken) {
|
|
|
|
setCSRFHeader(csrftoken);
|
|
|
|
setCSRFHeader(csrftoken);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -109,11 +117,12 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const host = window.cvat.config.backendAPI.slice(0, -7);
|
|
|
|
const host = window.cvat.config.backendAPI.slice(0, -7);
|
|
|
|
let csrf = null;
|
|
|
|
let csrf = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
csrf = await Axios.get(`${host}/auth/login`, {
|
|
|
|
csrf = await Axios.get(`${host}/auth/csrf`, {
|
|
|
|
proxy: window.cvat.config.proxy,
|
|
|
|
proxy: window.cvat.config.proxy,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (errorData) {
|
|
|
|
} catch (errorData) {
|
|
|
|
|