Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route match includes extra params #34

Open
whawker opened this issue May 2, 2018 · 1 comment
Open

Route match includes extra params #34

whawker opened this issue May 2, 2018 · 1 comment

Comments

@whawker
Copy link

whawker commented May 2, 2018

I am using qs to append arbitrary URL params to a route.

However when I match this back, it returns the additional params I added.

I would expect the below example to return { alertId: "456", id: "123" }

var route = new Route('/feeditems/:id?useralertId=:alertId')

var myEndpoint = route.reverse({ id: 123, alertId: 456 })
// Appending extra params with qs
myEndpoint += '&' + qs.stringify({ extraParam: 'value' }) // /feeditems/123?useralertId=456&extraParam=value

route.match('/feeditems/123?useralertId=456&extraParam=value')
/*
Returns
{
  alertId: "456&extraParam=value",
  id: "123"
}
*/
@m-lautenbach
Copy link

I guess it's intended to be used with location.pathname, which doesn't contain the query / search.
Note that what you mean is not route parameters, but query parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants