What is the usual way of handling query string parameters with sealgen form page? I am making password reset form.
I used Sealgen to add /reset/ endpoint for my form which causes redirect from /reset?token=abc
to /reset/
(without parameters).
I have also one other endpoint which uses query parameters but I forced to to accept paths without trailing slash by manually specifying it (you can see the code from link, I did’t use the path from the function argument and instead specified my own).
From what I can see from sealgen code, it automatically adds trailing slashes to everything.
https://hub.sealcode.org/source/sealgen/browse/master/src/mount.ts$63
Is there any way to get past this?
For reference this is the form I want to read query string parameters from. I already added valid canAccess function.
The “canonical” solution is to always use the trailing slash. Point the users to /reset/?token=abc
and it should be fine.
The trailing slashes are there for a reason - it makes certain use-cases that rely on relative paths simpler, as you can create a form that points to the current URL that you’re on just by specifying action="."
, so we don’t have to pass the URL down to the function that renders the form.
In the meantime, I’ll prepare a fix for that
Updated sealgen, fortunately it was a simple fix - update sealgen to v0.8.47
, the redirect should now keep the query params
/reset/?token=abc
seems weird and unusual but if that’s the canonical way I’ll deal with it.
“Canonical” in Sealious terms You can now use the endpoint without trailing slash with no obstacles, I agree that it looks better