feature/cierres #31

Merged
aldarien merged 462 commits from feature/cierres into develop 2025-09-11 17:05:18 -03:00
290 changed files with 909 additions and 12229 deletions
Showing only changes of commit b45d03aa7e - Show all commits

View File

@ -1,10 +1,10 @@
<script> <script>
class APIClient { class APIClient {
static getApiKey() {
return '{{md5($API_KEY)}}{{($login->isIn()) ? $login->getSeparator() . $login->getToken() : ''}}'
}
static fetch(url, options=null, showErrors=false) { static fetch(url, options=null, showErrors=false) {
return fetchAPI(url, options, showErrors)
}
}
function fetchAPI(url, options=null, showErrors=false) {
if (options === null) { if (options === null) {
options = {} options = {}
} }
@ -12,7 +12,7 @@
options['headers'] = {} options['headers'] = {}
} }
if (!Object.hasOwn(options['headers'], 'Authorization')) { if (!Object.hasOwn(options['headers'], 'Authorization')) {
options['headers']['Authorization'] = 'Bearer {{md5($API_KEY)}}{{($login->isIn()) ? $login->getSeparator() . $login->getToken() : ''}}' options['headers']['Authorization'] = `Bearer ${APIClient.getApiKey()}`
} }
return fetch(url, options).then(response => { return fetch(url, options).then(response => {
if (response.ok) { if (response.ok) {
@ -25,4 +25,8 @@
} }
}) })
} }
}
function fetchAPI(url, options=null, showErrors=false) {
return APIClient.fetch(url, options, showErrors)
}
</script> </script>