Nothing here yet.
Nothing here yet.
No blogs yet.
I don't understand the wording of your question. But from your code example it looks like you're trying to group an array of data by year. Not sure what you're doing with id and en ... and I'm assuming year_id is not a unique value. return this .user.titles.reduce((years, title) => { const { id , en, year_id } = title; const yearTitles = years[year_id] || {}; return { ...years, [year_id]: { ...yearTitles, [ id ]: title, [en]: title, }, }; }, {});
One way to do it would be to have a single saga responsible for making the calls (and doing the refresh-and-retry logic when the token fails)... and you have it take requests from an event channel. On the other side, you can have multiple sagas feeding requests into the event channel. That is the cleanest method I can think of off the top of my head. I suppose you could also fork each request and have some kind of synchronization via the store... e.g. once one of the forks gets a token failure, set a "lock" flag in the store to indicate that it is refreshing the token. And then other forks would check for this lock before they attempt to refresh. If the lock is set then they just wait for an action that indicates a new token is ready. Could make for a good blog post... hmm... :)
You won't have felt a need for it in Angular because Angular is a complete framework for SPA development. React is only a view layer, which is why you almost always see it paired with something else (e.g. React/Flux, React/Redux, React/MobX, etc).
Hi Sanghamitra. The good news is that there is a simple solution -- even simpler than the old infrastructure I'm currently using. I wrote about both here: https://decembersoft.com/posts/how-to-deploy-to-aws-lambda-from-circle-ci/ Thanks for the question!
There is nothing wrong with declaring a variable inside an if-statement block. However, if you're writing ES6 you should consider dropping var from your vocabulary. Use let and const instead (these do follow more logical scoping rules -- whereas var in your case would be scoped to the containing function)