Description
Describe the request
In the same way we tap into the routes to "push" new routes we can also change the default routes defined in /packages/venia-ui/lib/defaultRoutes.json
Possible solutions
How would you word this addition or change?
Screenshots
As we can see in the following image, makeRoutesTarget() initializes the Routes component. As part of this initialization if we have a target interceptor that "pushes" new routes to the routes array they will be added. Therefore in the routeList variable we'll have all those custom routes. After this, addRoutes(routeList, require('../defaultRoutes.json')) method is called with 2 params. The 2nd params is an array of default routes pre-defined for pwa.
If we need to edit some of the default pre-defined routes we can do it in our custom interceptor by tapping into routes target and specifiying the "pattern" that we want to update (see following image):
In the prior example, the "/communications" route is being updated to redirect to 404 whenever someone tries to access it.