Update api.js

This commit is contained in:
Saifeddine ALOUI
2025-01-31 16:03:31 +01:00
committed by GitHub
parent 2444975bf1
commit e9591548b4

View File

@@ -17,11 +17,12 @@ const showToast = (message, duration = 3000) => {
const fetchWithAuth = async (url, options = {}) => { const fetchWithAuth = async (url, options = {}) => {
const headers = { const headers = {
...(options.headers || {}), ...(options.headers || {}),
...(state.apiKey ? { 'Authorization': `Bearer ${state.apiKey}` } : {}) ...(state.apiKey ? { 'X-API-Key': state.apiKey } : {}) // Use X-API-Key instead of Bearer
}; };
return fetch(url, { ...options, headers }); return fetch(url, { ...options, headers });
}; };
// Page renderers // Page renderers
const pages = { const pages = {
'file-manager': () => ` 'file-manager': () => `