diff options
author | polwex <polwex@sortug.com> | 2025-06-15 04:59:49 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-06-15 04:59:49 +0700 |
commit | 71c20233ff79e696d0eeca2ce1462d3083fbcfed (patch) | |
tree | 4491f680fb6fe65e9d8606764c7000396856e93e /bs5/universal/js/ClientRouter.re | |
parent | 241dc9c99bed4dddbc748aad54cee5bf7d77ab92 (diff) |
and were done, just like that
Diffstat (limited to 'bs5/universal/js/ClientRouter.re')
-rw-r--r-- | bs5/universal/js/ClientRouter.re | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bs5/universal/js/ClientRouter.re b/bs5/universal/js/ClientRouter.re new file mode 100644 index 0000000..40083c2 --- /dev/null +++ b/bs5/universal/js/ClientRouter.re @@ -0,0 +1,22 @@ +type t = Router.t(Fetch.Response.t); + +external navigate: string => unit = "window.__navigate"; +external useAction: + (string, string) => ((Router.payload, Router.location, unit) => unit, bool) = + "window.__useAction"; + +let useRouter: unit => t = + () => { + { + location: Router.initialLocation, + navigate: str => { + navigate(Router.locationToString(str)); + }, + useAction: (endpoint, method) => { + useAction(endpoint, method); + }, + refresh: str => { + Js.log(str); + }, + }; + }; |