From 6cb0ff5e00db4380a03ab3c9a6f10de567750791 Mon Sep 17 00:00:00 2001 From: Simon Dalvai Date: Thu, 7 Mar 2024 13:54:18 +0100 Subject: [PATCH] events: initialize fetchAuthorized before use --- src/main/webapp/view-events.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/view-events.js b/src/main/webapp/view-events.js index b105c89..61016d6 100644 --- a/src/main/webapp/view-events.js +++ b/src/main/webapp/view-events.js @@ -73,6 +73,15 @@ }) + const fetchAuthorized = (url, authToken) => { + if (authToken) { + return fetch(url, { headers: { "Authorization": authToken } }) + } else { + return fetch(url) + } + } + + // load the categories dinamically every time the data provider is changed _provider.addEventListener("change", async (e) => { // add an