Skip to content

Commit

Permalink
events: initialize fetchAuthorized before use
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Mar 7, 2024
1 parent a53aaca commit 6cb0ff5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/main/webapp/view-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <option> into a <select>
Expand Down Expand Up @@ -232,14 +241,6 @@
}
}

const fetchAuthorized = (url, authToken) => {
if (authToken) {
return fetch(url, { headers: { "Authorization": authToken } })
} else {
return fetch(url)
}
}

// handle the form submission - here is where the main work is done
_query.addEventListener("click", async () => {
// collect the form data into a cleaner object
Expand Down

0 comments on commit 6cb0ff5

Please sign in to comment.