Mirror of
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: not checking image before opening

+18 -26
+18 -26
src/pages/index.astro
··· 229 229 <option value="quicksand">Quicksand</option> 230 230 <option value="raleway">Raleway</option> 231 231 <option value="readexpro" selected>Readex Pro</option> 232 + <option value="roboto">Red Hat Text</option> 232 233 <option value="roboto">Roboto</option> 233 234 <option value="robotomono">Roboto Mono</option> 234 235 <option value="rubik">Rubik</option> ··· 348 349 generateBtn.disabled = true; 349 350 generateBtn.textContent = "Generating... ⏳"; 350 351 351 - try { 352 - const formData = new FormData(form); 353 - const params = new URLSearchParams(); 352 + const formData = new FormData(form); 353 + const params = new URLSearchParams(); 354 354 355 - for (const [key, value] of formData.entries()) { 356 - if (value && key !== "primaryColor" && key !== "useRandomColor") { 357 - params.append(key, value); 358 - } else if ( 359 - key === "primaryColor" && 360 - useRandomColor.value === "false" 361 - ) { 362 - params.append(key, colorInput.value); 363 - } 355 + for (const [key, value] of formData.entries()) { 356 + if (value && key !== "primaryColor" && key !== "useRandomColor") { 357 + params.append(key, value); 358 + } else if ( 359 + key === "primaryColor" && 360 + useRandomColor.value === "false" 361 + ) { 362 + params.append(key, colorInput.value); 364 363 } 364 + } 365 365 366 - const url = `/api/generateImage?${params.toString()}`; 366 + const url = `/api/generateImage?${params.toString()}`; 367 367 368 - // Test the endpoint first 369 - const response = await fetch(url, { method: "HEAD" }); 370 - if (response.ok) { 371 - window.open(url, "_blank"); 372 - } else { 373 - throw new Error(`API returned ${response.status}`); 374 - } 375 - } catch (error) { 376 - alert(`Failed to generate image: ${error.message}`); 377 - } finally { 378 - generateBtn.disabled = false; 379 - generateBtn.textContent = originalText; 380 - } 368 + // Test the endpoint first 369 + const response = await fetch(url, { method: "HEAD" }); 370 + window.open(url, "_blank"); 371 + generateBtn.disabled = false; 372 + generateBtn.textContent = originalText; 381 373 }); 382 374 </script> 383 375 </body>