broadfield-dev commited on
Commit
24922e0
·
verified ·
1 Parent(s): 6303399

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +19 -13
templates/index.html CHANGED
@@ -165,20 +165,26 @@
165
  loading.style.display = 'block';
166
  });
167
 
168
- // Redirect to load feeds on page load
169
- fetch('/load_feeds')
170
- .then(response => {
171
- if (response.status === 200) {
172
- window.location.href = '/index';
173
- } else {
174
- console.error('Failed to load feeds');
 
 
 
 
 
 
 
 
 
175
  loading.style.display = 'none';
176
- }
177
- })
178
- .catch(error => {
179
- console.error('Error loading feeds:', error);
180
- loading.style.display = 'none';
181
- });
182
  });
183
  </script>
184
  </body>
 
165
  loading.style.display = 'block';
166
  });
167
 
168
+ // Poll until feeds are loaded
169
+ function checkFeeds() {
170
+ fetch('/check_feeds')
171
+ .then(response => response.json())
172
+ .then(data => {
173
+ if (data.status === "loaded") {
174
+ window.location.href = '/index';
175
+ } else if (data.status === "error") {
176
+ console.error('Error loading feeds:', data.message);
177
+ loading.style.display = 'none';
178
+ } else {
179
+ setTimeout(checkFeeds, 1000); // Check every second
180
+ }
181
+ })
182
+ .catch(error => {
183
+ console.error('Error checking feeds:', error);
184
  loading.style.display = 'none';
185
+ });
186
+ }
187
+ checkFeeds();
 
 
 
188
  });
189
  </script>
190
  </body>