From: Chris Fulljames Date: Sat, 22 Mar 2025 23:12:55 +0000 (-0400) Subject: Fix error pages for form submission X-Git-Url: https://littlesong.place/gitweb/?a=commitdiff_plain;h=45e8ab371e705e174cdfa7acee16e8589572b77a;p=littlesongplace.git Fix error pages for form submission --- diff --git a/static/nav.js b/static/nav.js index f2998a8..1e1af84 100644 --- a/static/nav.js +++ b/static/nav.js @@ -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") diff --git a/todo.txt b/todo.txt index 7f8d8d6..01ade2e 100644 --- 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?)