I'm not allowed to depend on the user state or check for the user session id. Also, this solution can use the front-end but should use it the least amount possible.
Basically, the error page is always and ONLY supposed to show when the user refreshes the page (not redirects from the app/site) or when the link is entered without the query string parameter.
Initially, I though this would be easy to implement but over a week I've been absolutely stuck on this issue. I think there's a disconnect perhaps in terms of my understand of Node.JS & Express.JS with the front-end, so that issues below have me stumped.
In my attempts, either a potential solution I'd find isn't compatible with internet explorer or I'd find something that could be a solution but ends up leading to other related issues that I don't understand how to approach.
Issue 1: Adding the Query String Parameter to the URL using res.query is causing request issues
For example, in the middle-ware function with Express.JS that I used to detect when Internet Explorer is used, I would check the request URL for any query parameters using req.query (res.param isn't compatible with IE) and then if it does, I would add it to the response again using res.query.
However, I noticed that this (trying to persist the query parameter using res.query with the parameter value) causes issues in the requests being sent when I do this. However, I'm not sure how else to persist the url through the server-side with Express.JS in a way that's compatible with IE.
Issue 2: Query String Parameter Should Persist in the URL during App Routing but it doesn't
Next, there's the issue of routing that happens in the app. For example, when the user clicks around the app to localhost/settings or localhost/profile/password. There isn't one file on the app that I can pinpoint that targets all redirects and I can't rewrite each one for this specific use case.
So pretty much, I'm stuck on how to detect the routing once the user is logged in, so that if the query string existed in the URL before the routing, I can add simply keep it there UNLESS they refresh the page or enter the URL again WITHOUT the query string parameter.
Issue 3: Query String Parameter Should Persist during URL Redirecting but it doesn't
Another issue is the redirecting. There's no specific file I can directly reference that accounts for redirecting. Sometimes, a link is clicked that might redirect once or twice, meaning I can no longer detect the query string parameter in the request or pinpoint how to persist it. I need to somehow detect when redirect is happening, and maintain the query string in the URL if this is the case.
Any tips on how I can approach these three issues? Or, documentation or examples that you can point me to? I seriously feel blocked on this and worry that I'll be stuck on this issue forever. Thanks
submitted by /u/existtodebate
[link] [comments]
from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/86SBhak