Ash FrameworkAF
Ash Framework3y ago
51 replies
Blibs

Parse a new FilterForm from url params

I don't know if I'm missing something, but I can't find a way to fetch the components from a filter form as a map to add it as params for the URL query and then parse it back to a new FilterForm from these same params?

For example, let's say I have a FilterForm with 2 predicates, I want to extract that information into a map so I can use it to form my url like this:

filter_params = FilterForm.some_function(form)

push_patch(socket, to: "/my_url?#{filter_params}")


And then, inside a handle_params, get that filter_params back and recreate that same FilterForm:

form = FilterForm.parse(User, filter_params)
Was this page helpful?