Proposal to refactor how transactions are processed #787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In response to issue #740
Implementation
I went through /web-auth/index.js and saw duplicate param arrays
[ 'redirectUri', 'responseType', 'scope', 'audience', '_csrf', 'state', '_intstate', 'nonce' ]
Some param arrays were passing in slightly different strings for different prototype methods (i.e. responseMode). I created a 'base' param array that gets concated with custom values at the top of the index.js file.
More ideal implementation
Ideally, I would create a file of constants separate from this index.js file and require it whereever needed. This file of constants could help fill in vars with vscode's intellisense and eliminate magic strings, but I didn't want to make any large changes.
Notes
-There's two unrelated lines that have different spacing. I didn't touch these lines. I'm unsure if it's a prettifier or minifier that's adding spacing.
-I tried to use the 'const' keyword instead of vars, when setting arrays, but I think I'm pointing to an older version of es6
-There's another similar params array inside /web-auth/popup.js, but it has different params, if there was a constants file (from the more ideal implementation section) this would be a use case
Feedback
let me know if there's anything that can be improved! Or if you're passing on this, feel free to let me know why!