Fork me on GitHub

I'm wondering whether there is a way to use the controllers facility in reitit-frontend within a re-frame app to record the original route that an as yet unauthorised user navigates to, send a user to a login route then after successful authentication send the app back to the original route? I've got the redirect working by firing a re-frame event on the controllers for routes that require an authenticated session, the event handler then push-states the app to the login route if no auth session exists. but i'm not clear whether its possible to determine the original route within the controller so that it can pass this along with the re-frame event to be recorded and then restored when the login completes.


I’m curious what responses you get, @grahamcarlyle, because I don’t know of a “built-in” solution for this, so I rolled my own, but I don’t know that it is very elegant. Maybe there is something out there that addresses this issue better.


Is there any documentation on what the :options argument in reitit.coercion.malli/create takes?


I assumed that it was the same as the options you could pass to a Malli validator, but it looks like that isn’t the case.


Is there a way of assigning a custom registry to Malli coercion?


@weavejester see and the source of. reitit.coercion.malli/create. the docs are lagging, PRs most welcome


Hey @ikitommi, I’ve been looking at the source but I haven’t been able to get it to work. My current attempt is: (reitit.coercion.malli/create {:options {:registry …}})


Unfortunately I get the rather opaque :malli.core/invalid-schema error


I’ve simplified it down to: (reitit.coercion.malli/create {:options {:registry {::email :string}}}), but that still says it’s an invalid schema :data {:schema :map} so I’m doing something wrong.


:thinking_face: can you make a minimal gist/repro. I can look in the morning.


No problem. I’ll plug away at this a little myself first, and see if I can’t figure it out 🙂


Maybe this is a Malli problem…


Aha, yes, solved it. I was assuming that the Malli :registry key worked the same way as an option to malli.core/validator as it does when included in a :schema block. What I needed to do was:

(reitit.coercion.malli/create {:options {:registry (mr/registry (merge (m/default-schemas) {::email :string}))}})

👍 1