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

Unable to redirect with params #483

Closed
nym opened this issue Mar 30, 2017 · 5 comments
Closed

Unable to redirect with params #483

nym opened this issue Mar 30, 2017 · 5 comments

Comments

@nym
Copy link

nym commented Mar 30, 2017

I'm submitting a feature request
Redirecting with parameters does not work in the same way that directing with query parameters do.

Given:
{route: "path/to/:id/old", redirect: "path/to/:id/new"}

Expected:
/path/to/9000/old ->
/path/to/9000/new

Actual:
/path/to/9000/old ->
/path/to/:id/new

From the source, it appears that query parameters are passed along as part of redirectLocation, but parameters are not being replaced despite being available in instruction.params.

if ('redirect' in config) {

@EisenbergEffect
Copy link
Contributor

I agree, this would be a great feature. Any interest in working on a contribution to add it?

@nym
Copy link
Author

nym commented Mar 31, 2017

@EisenbergEffect sure- is there an approach you would recommend? My initial thought was that parsing / replacing params in the section I listed would make sense, but a) want to make sure that is correct and b) is there something that is designed to do this already that I should reuse instead of writing regex to replace by :param/ with ${param}/ ?

Finally, what are the requirements for getting a PR accepted? I am going to try to do this over the weekend and want to do it right the first time.

@EisenbergEffect
Copy link
Contributor

There are some existing APIs to help you out. You shouldn't need to mess with RegEx. Have a look at what happens with the basic route and you should be able to emulate the same thing.

@balazsmeszegeto
Copy link
Contributor

@nym I'm interested in creating a PR for this, if you'd need help

jagonalez added a commit to jagonalez/router that referenced this issue Aug 29, 2017
allow redirect fragments to contain token parameter

this closes feature request aurelia#483
jagonalez added a commit to jagonalez/router that referenced this issue Aug 29, 2017
allow redirect to contain token parameters for router config

this closes feature request aurelia#483
@Alexander-Taran
Copy link
Contributor

Can be closed

@davismj davismj closed this as completed Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants