Fork me on GitHub
#reitit
<
2023-01-06
>
Dallas Surewood08:01:40

I am confused by the documentation of reitit.frontend, and I'm not sure how I can actually restrict routes because IDK how it compares to reitit on the backend. I need to restrict certain pages if an atom doesn't have a specific value in it. But I also need to be able to pass params from the URL to the components I'm rendering. This is the closest I got. wrap-restricted takes someone to login if they aren't logged in. But this solution doesn't really work for me. Is there a more idiomatic way to do this?

dharrigan16:01:06

I can use muuntaja decode/encode the request/response body to/from kebab case/camelCase, but is there a similar facility to kebabify query parameters in a GET request? i.e., if I do GET /foo?lastName=bar, and if I have a malli spec like {:parameters {:query [:map [:last-name :string]]}}, it would appear in {:parameters {:query {:last-name "bar"}}}. So far it appears the only way to do this is to use a bit of middleware to update the {:parameters {:query...}} structure directly.

dharrigan16:01:39

Is there a better way?