Next-routes: Parameters vs Query

Created on 12 May 2017  路  3Comments  路  Source: fridays/next-routes

Hey guys, I'm trying to resolve an issue and was hoping for some help. When navigating to a sub route from the client I am getting the sku field as query string, but I need it as a parameter. It works as a parameter on server load but not client.
Example

<Link route='product' params={{sku:product.sku}}><a>Product 1</a></Link>
<Link route='product' params={{sku:product.sku}}><a>Product 2</a></Link>

Now if I load this url /product/123 directly it works and loads the correct page. However, if I am on another page and click on the links above the url read /product?sku=123. I need both links to the the former. How can I get this fixed. Appreciate any pointers.

Most helpful comment

Sorry, guys I figured it out. Must be the lack of sleep playing tricks 馃槼

All 3 comments

Sorry, guys I figured it out. Must be the lack of sleep playing tricks 馃槼

@nishtacular What was the problem here ?

@supra28 Not sure if you're still after an answer but from memory i wasn't including the sku in route definition. See example below

routes.add('product', '/product'); // the WRONG way
--
routes.add('product', '/product/:sku?'); 
Was this page helpful?
0 / 5 - 0 ratings