From 3c0bfa2cd534ccc602b62013d28a3a5d5319f037 Mon Sep 17 00:00:00 2001 From: AdrienLSH Date: Wed, 6 Mar 2024 11:08:48 +0100 Subject: [PATCH] client: all requests to server now include language preference --- frontend/static/js/api/Client.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/static/js/api/Client.js b/frontend/static/js/api/Client.js index 63b4eb8..56f72c6 100644 --- a/frontend/static/js/api/Client.js +++ b/frontend/static/js/api/Client.js @@ -96,6 +96,9 @@ class Client { let response = await fetch(this._url + uri, { method: "GET", + headers: { + 'Accept-Language': this.lang.currentLang + }, body: JSON.stringify(data), }); return response; @@ -134,7 +137,8 @@ class Client headers: { "Content-Type": "application/json", "X-CSRFToken": getCookie("csrftoken"), - }, + 'Accept-Language': this.lang.currentLang, + }, body: JSON.stringify(data), }); return response; @@ -153,7 +157,8 @@ class Client headers: { "X-CSRFToken": getCookie("csrftoken"), "Content-Type": "application/json", - }, + 'Accept-Language': this.lang.currentLang, + }, body: JSON.stringify(data), }); return response; @@ -171,7 +176,8 @@ class Client method: "PATCH", headers: { "X-CSRFToken": getCookie("csrftoken"), - }, + 'Accept-Language': this.lang.currentLang, + }, body: file, }); return response;