client: all requests to server now include language preference

This commit is contained in:
AdrienLSH 2024-03-06 11:08:48 +01:00
parent 6d9decf913
commit daddf5bb25

View File

@ -96,6 +96,9 @@ class Client
{ {
let response = await fetch(this._url + uri, { let response = await fetch(this._url + uri, {
method: "GET", method: "GET",
headers: {
'Accept-Language': this.lang.currentLang
},
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
return response; return response;
@ -134,6 +137,7 @@ class Client
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"X-CSRFToken": getCookie("csrftoken"), "X-CSRFToken": getCookie("csrftoken"),
'Accept-Language': this.lang.currentLang,
}, },
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
@ -153,6 +157,7 @@ class Client
headers: { headers: {
"X-CSRFToken": getCookie("csrftoken"), "X-CSRFToken": getCookie("csrftoken"),
"Content-Type": "application/json", "Content-Type": "application/json",
'Accept-Language': this.lang.currentLang,
}, },
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
@ -171,6 +176,7 @@ class Client
method: "PATCH", method: "PATCH",
headers: { headers: {
"X-CSRFToken": getCookie("csrftoken"), "X-CSRFToken": getCookie("csrftoken"),
'Accept-Language': this.lang.currentLang,
}, },
body: file, body: file,
}); });