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);
|
console.error('Error fetching proposals:', error);
|
||||||
showErrorMessage('Failed to load petitions. Please check the console for details.', true);
|
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
|
// Function to render all proposals
|
||||||
|
|
|
||||||
23
worker.js
23
worker.js
|
|
@ -2,7 +2,11 @@
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
'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',
|
||||||
|
=======
|
||||||
|
'Access-Control-Allow-Headers': 'Content-Type, Authorization, Accept, Cache-Control, X-Requested-With',
|
||||||
|
>>>>>>> Stashed changes
|
||||||
'Access-Control-Max-Age': '86400'
|
'Access-Control-Max-Age': '86400'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -11,10 +15,21 @@ const DEFAULT_PAGE_SIZE = 20;
|
||||||
const MAX_PAGE_SIZE = 100;
|
const MAX_PAGE_SIZE = 100;
|
||||||
|
|
||||||
// Handle OPTIONS request for CORS preflight
|
// Handle OPTIONS request for CORS preflight
|
||||||
function handleOptions() {
|
function handleOptions(request) {
|
||||||
return new Response(null, {
|
if (
|
||||||
headers: corsHeaders
|
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
|
// Helper to create standardized responses
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue