Closed alexfauquette closed 2 years ago
Hey! I am interested to work on this issue. Could you please assign it to me?
The way I am thinking of solving this issue is to replace all the POST request sections with a code block like: if(IS_DEVELOPMENT_MODE){ console.log(...) } else { axios.post(...) }
Is this approach fine? Or should I do it some other way?
That's ok, maybe the constant should be defined only once (in const.js
for example) such that if someone wants to try post
methods in dev mode she can do it by modifying only one line of code
Oh yes, I'll add it to const.js. Thank you!
Story
For now, there is no distinction between being in "production" or "development" environment. To test a feature you could be tempted to answer randomly Yes or No to questions just to test your feature. Please do NOT do that
As said before, there is no distinction between environments, so all the questions you answer will be sent to servers that will apply the modification. So if you answer "Yes" to the question "Is that a chicken" and it was a fish, the product will see a fish in the list of chicken products 🙀
So either you take care of answering correctly to the questions, or you do not answer, you only skip them
Preventing this problem
It is possible by checking
NODE_ENV
variable to know if the code runs in production or in development mode:I propose that if we are in development mode
axios.post
andaxios.put
are replaced by aconsole.log
such that it does not impact our servers' data