diff src/save_edit.js.luan @ 42:0c1b820fff34

use push
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 08 Nov 2022 14:02:28 -0700
parents 66fd3784e60e
children 96f0c3d65698
line wrap: on
line diff
--- a/src/save_edit.js.luan	Sun Nov 06 17:39:21 2022 -0700
+++ b/src/save_edit.js.luan	Tue Nov 08 14:02:28 2022 -0700
@@ -9,6 +9,10 @@
 local Bbcode = require "site:/lib/Bbcode.luan"
 local bbcode_to_html = Bbcode.to_html or error()
 local Db = require "site:/lib/Db.luan"
+local Shared = require "site:/lib/Shared.luan"
+local base_url = Shared.base_url or error()
+local Logging = require "luan:logging/Logging.luan"
+local logger = Logging.logger "save_edit.js"
 
 
 return function()
@@ -21,10 +25,11 @@
 		post.save()
 	end )
 	local html = output_of(function() bbcode_to_html(post.content) end)
-	Io.stdout = Http.response.text_writer()
+	local js = output_of(function()
 %>
-let postDiv = document.querySelector('[post="<%=post.id%>"]');
-cancelEdit(postDiv);
-postDiv.querySelector('[message]').innerHTML = <%= json_string(html) %>;
+updated( '<%=post.id%>', <%= json_string(html) %> );
 <%
+	end)
+	local url = base_url().."/thread.html?root="..post.root_id
+	Http.push(url,js)
 end