From 9d02110d8b41607169508b28e0a7925ddf278e08 Mon Sep 17 00:00:00 2001 From: ZhurmilovVadim Date: Mon, 4 Mar 2024 11:51:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?JWT=20=D0=B2=20localStorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/src/modules/ajax.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/src/modules/ajax.js b/public/src/modules/ajax.js index 9766718d..b91c3714 100644 --- a/public/src/modules/ajax.js +++ b/public/src/modules/ajax.js @@ -9,6 +9,8 @@ const methods = { let JWT = null +JWT = window.localStorage.getItem('Authorization') + const baseRequest = async (method, url, data = null) => { const options = { method: method, @@ -36,12 +38,9 @@ const baseRequest = async (method, url, data = null) => { } catch (err) { console.log("no body") } - for (const header of response.headers) { - console.log(header) - } if (response.headers.get('Authorization') !== null) { JWT = response.headers.get('Authorization'); - console.log(JWT) + window.localStorage.setItem('Authorization', JWT) } return {status: response.status, body} } catch (err) {