From: Code-Otto Date: Wed, 26 Jun 2024 21:20:26 +0000 (+0200) Subject: Don't overwrite Authorization HTTP header when no token is saved X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=33dd2731383d35d56100c6a9c5f2409cd3ce963c;p=flatnotes.git Don't overwrite Authorization HTTP header when no token is saved This fixes setups where Flatnotes runs behind a proxy doing authentication on its own --- diff --git a/client/api.js b/client/api.js index 4657f98..46e3dca 100644 --- a/client/api.js +++ b/client/api.js @@ -14,7 +14,9 @@ api.interceptors.request.use( function (config) { if (config.url !== "api/token") { const token = getStoredToken(); - config.headers.Authorization = `Bearer ${token}`; + if (token) { + config.headers.Authorization = `Bearer ${token}`; + } } return config; },