BraydenMoore commited on
Commit
bf6c3d3
1 Parent(s): ba5fb92

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +8 -8
templates/index.html CHANGED
@@ -277,6 +277,14 @@
277
  async function refreshImage() {
278
  try {
279
  const response = await fetch(newUrl, { method: 'HEAD' });
 
 
 
 
 
 
 
 
280
  const contentType = response.headers.get('Content-Type');
281
  if (response.ok) {
282
  if (/image\/jpe?g/.test(contentType)) {
@@ -287,14 +295,6 @@
287
  }
288
  } catch (error) {
289
  console.error('Fetch failed:', error);
290
- if (error.name === 'AbortError') {
291
- console.error('Fetch aborted:', error);
292
- } else {
293
- console.error('Fetch failed:', error);
294
- }
295
- if (firstLoad) {
296
- window.location.href = "?new=true";
297
- }
298
  }
299
  }
300
 
 
277
  async function refreshImage() {
278
  try {
279
  const response = await fetch(newUrl, { method: 'HEAD' });
280
+ if (!response.ok) { // If HTTP code is not OK (like 500)
281
+ console.error(`Fetch failed with status: ${response.status}`);
282
+ if (firstLoad) {
283
+ window.location.href = "?new=true";
284
+ }
285
+ return;
286
+ }
287
+
288
  const contentType = response.headers.get('Content-Type');
289
  if (response.ok) {
290
  if (/image\/jpe?g/.test(contentType)) {
 
295
  }
296
  } catch (error) {
297
  console.error('Fetch failed:', error);
 
 
 
 
 
 
 
 
298
  }
299
  }
300