Wildcard support in router with setParams
See original GitHub issueMaybe I am doing it absolutely wrong but I am not able to use wildcards with FlowRouter correctly.
Everything I am describing in this issue is able to recognize in this repository:
https://github.com/TimoRuetten/test-flow-router-wildcard-problem
1. Problem: How to define a Wildcard URL in FlowRouter ?
I’ve found 2 ways to do this. The first is /wildcard* and the second is /wildcard(.*) - it seems that both of them are the same in my case. There is no difference when using these urls.
2. Problem: How to set params to a Wildcard-Param with FlowRouter.setParams ?
Thats the main problem. It seems that this is not possible with setParams. As you can see in my repository I am trying it in 2 ways:
const words = ['Word1', 'word2'];
FlowRouter.setParams({
wildcard: words.join('/')
});
FlowRouter.setParams({
wildcard: words
});
What I expect when calling the setParams method is in this case this url: /Word1/Word2 - but thats not what I get.
What I get with words.join(‘/’): The URL looks like this: /Word1%252FWord2 In my params Object is this: ‘Word1/Word2’
What I get with words: The URL looks like this: /Word1%252CWord2 In my params Object is this: 'Word1,Word2’
I don’t know why but when I give an array to setParams FlowRouter will join them with comma.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6
Top GitHub Comments
A hacky way is to replace Router.prototype.go function =)
a little improvement over the @alexandrzavalii hack