]> littlesong.place Git - littlesongplace.git/commitdiff
Fix error pages for form submission
authorChris Fulljames <christianfulljames@gmail.com>
Sat, 22 Mar 2025 23:12:55 +0000 (19:12 -0400)
committerChris Fulljames <christianfulljames@gmail.com>
Sat, 22 Mar 2025 23:12:55 +0000 (19:12 -0400)
static/nav.js
todo.txt

index f2998a8057a2a29e9cfaa41d49c88bf500a90e94..1e1af844d2ec8930120ef41563e374327eb1f891 100644 (file)
@@ -71,8 +71,13 @@ var m_messageBoxTimeout;
 
 async function handleAjaxResponse(response) {
     if (response.status != 200) {
-        // Got an error; redirect to the error page
-        window.location.href = response.url;
+        // Error occurred - Get page content from response
+        var url = new URL(response.url);
+        var text = await response.text();
+        document.open("text/html", "replace");
+        document.write(text);
+        document.close();
+        return;
     }
 
     if (response.headers.get("content-type") === "application/json")
index 7f8d8d632fbad4ccbced1d82f379e30b3bb74651..01ade2e2ab6d9723e747e16f66ca573155d25dfc 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1,7 +1,5 @@
 SOON
-- Generalize nofications
 - Fix: refresh -> navigate -> back shows pre-refresh page
-- Fix: http errors not shown for form submissions
 - Player minimize button
 - Break up main.py, test_offline.py
 - Image support in comments, descriptions, bios, etc. (rich text?)