2

Is it possible to match on a url route that has a hash fragment at the end of it such as example.com/examplePath#field1=value&field2=anotherValue using the purescript-routing library? This is with the intent to be able to get a Map String String value out of a name-value pair in the hash fragment.

(Should I be using a different library (like purescript-uri) in order to get hash-fragment values out the URL route?)

I know that the params function from the Routing.Match.Class module in purescript-routing can operate on query parameters to do something similar to this - but in this case I'm trying to get the values out of the URL that a user will be redirected to after a Google OAuth login. For a client-side web app the access token is returned as a name=value pair in the hash (#) fragment of the URI rather than a query string.

The issue is that the cases I create for a URL that has a hash fragment in my routing :: Match Routes function do not seem to match and the route matches on my catch all case at the end.

So for a route like example.com/auth/#field=value the corresponding case would be:

routing = auth 
       <|> ... the other cases
  where auth = Auth <$> (lit "" *> lit "auth" *> str)

but this fails to match on a url if it has a # on the end.

chups
  • 53
  • 5

0 Answers0