summaryrefslogtreecommitdiff
path: root/lib/html.ml
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-06-27 16:34:09 +0700
committerpolwex <polwex@sortug.com>2025-06-27 16:34:09 +0700
commit645e815ebe11dbb86781c3eb645d3d67cd62cf7c (patch)
tree347b03391a5245de8a43198c9646719c2e892373 /lib/html.ml
parent8be9a806a93b02eada372f3993c34bc6b2f26fea (diff)
nice nice. lsp still doesnt work tho
Diffstat (limited to 'lib/html.ml')
-rw-r--r--lib/html.ml13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/html.ml b/lib/html.ml
index db5ad51..35c7b42 100644
--- a/lib/html.ml
+++ b/lib/html.ml
@@ -1,6 +1,7 @@
open Piaf
+open Shared
-type pool = ((module Rapper_helper.CONNECTION), Caqti_error.t) Caqti_eio.Pool.t
+type pool = (Query.conn, Caqti_error.t) Caqti_eio.Pool.t
(* This is the main handler function for the GET /posts endpoint. *)
(* It takes a database connection pool and a Piaf request as input. *)
@@ -33,7 +34,9 @@ let get_root (db_pool : pool) (request : Request.t) =
db_pool
;;
-let render page (db_pool : pool) (_request : Request.t) =
+type paget = ?key:string -> Query.conn -> unit -> React.element
+
+let render_conn (page : paget) (db_pool : pool) (_request : Request.t) =
(* Caqti_eio.Pool.use *)
(* (fun conn -> *)
(* let posts_or = Query.get_poasts () conn in *)
@@ -44,6 +47,10 @@ let render page (db_pool : pool) (_request : Request.t) =
(* | Ok _posts -> Ok (page |> ReactDOM.renderToString |> Http.send_raw_html)) *)
(* db_pool *)
Caqti_eio.Pool.use
- (fun conn -> Ok (conn |> page |> ReactDOM.renderToString |> Http.send_raw_html))
+ (fun conn -> Ok (page conn () |> ReactDOM.renderToString |> Http.send_raw_html))
db_pool
;;
+
+let render page (_db_pool : pool) (_request : Request.t) =
+ Ok (page |> ReactDOM.renderToString |> Http.send_raw_html)
+;;