diff --git a/index.html b/index.html
index a3a2f74..604abe8 100644
--- a/index.html
+++ b/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
diff --git a/worker.js b/worker.js
index e7c80da..4a4d1a5 100644
--- a/worker.js
+++ b/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