The router should do a fetch request without following the redirect and if the response does have a redirect in it it should follow that manually by calling router.goTo(newUrl).
Examples when this is happening:
history url, the frontend should here go to the target
expired session the frontend should go to the login
Currently when we are requesting any url which will be redirected the
router.js
will not redirect the frontend:This is the case because fetch is by default following here the redirect and so will return the target data: https://github.com/sulu/SuluHeadlessBundle/blob/fc701ca9c79ad490c35501db00097bab5132bf13/Resources/js-website/src/services/router.js#L47
The router should do a fetch request without following the redirect and if the response does have a redirect in it it should follow that manually by calling router.goTo(newUrl).
Examples when this is happening: