x
This commit is contained in:
parent
da90747631
commit
330bd1ff61
2 changed files with 32 additions and 4 deletions
13
index.html
13
index.html
|
|
@ -757,6 +757,19 @@ async function safeFetch(url, options = {}) {
|
|||
console.error('Error fetching proposals:', error);
|
||||
showErrorMessage('Failed to load petitions. Please check the console for details.', true);
|
||||
}
|
||||
|
||||
// Hide loading indicator
|
||||
function hideLoadingIndicator() {
|
||||
const proposalsContainer = document.getElementById('proposals-container');
|
||||
if (proposalsContainer) {
|
||||
// Only remove if it exists
|
||||
const loadingIndicator = proposalsContainer.querySelector('.loading-indicator');
|
||||
if (loadingIndicator) {
|
||||
loadingIndicator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Function to render all proposals
|
||||
|
|
|
|||
23
worker.js
23
worker.js
|
|
@ -2,7 +2,11 @@
|
|||
const corsHeaders = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
||||
<<<<<<< Updated upstream
|
||||
'Access-Control-Allow-Headers': 'Content-Type, Authorization, Accept',
|
||||
=======
|
||||
'Access-Control-Allow-Headers': 'Content-Type, Authorization, Accept, Cache-Control, X-Requested-With',
|
||||
>>>>>>> Stashed changes
|
||||
'Access-Control-Max-Age': '86400'
|
||||
};
|
||||
|
||||
|
|
@ -11,10 +15,21 @@ const DEFAULT_PAGE_SIZE = 20;
|
|||
const MAX_PAGE_SIZE = 100;
|
||||
|
||||
// Handle OPTIONS request for CORS preflight
|
||||
function handleOptions() {
|
||||
return new Response(null, {
|
||||
headers: corsHeaders
|
||||
});
|
||||
function handleOptions(request) {
|
||||
if (
|
||||
request.headers.get('Origin') !== null &&
|
||||
request.headers.get('Access-Control-Request-Method') !== null &&
|
||||
request.headers.get('Access-Control-Request-Headers') !== null
|
||||
) {
|
||||
return new Response(null, {
|
||||
headers: corsHeaders,
|
||||
status: 204
|
||||
});
|
||||
} else {
|
||||
return new Response(null, {
|
||||
headers: corsHeaders
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to create standardized responses
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue