add solutions in directory according to the difficulty#230
add solutions in directory according to the difficulty#230samipsuwal wants to merge 1 commit intoQasimWani:mainfrom
Conversation
vikas-deshpande
left a comment
There was a problem hiding this comment.
Where is the difficulty defined?
|
Hi Vikas, |
Got it, thanks! |
| ) => { | ||
| // To validate user, load user object from GitHub. | ||
| const URL = `https://api.github.com/repos/${hook}/contents/${directory}/${filename}`; | ||
| const URL = `https://api.github.com/repos/${hook}/contents/${difficulty}/${directory}/${filename}`; |
There was a problem hiding this comment.
I'd put a check that difficulty is assigned, and if not - I'd print out some kind of error, or log it somehow. You're working with the globally set variable, it'll help to ensure it's initialized.
There was a problem hiding this comment.
Can you please help to check the above comment @samipsuwal?
There was a problem hiding this comment.
@NikitaShkaruba @karankap00r adding an if-else is making the code async, due to which URL is not being instantiated on time.
Adding a log isn't difficult,
However, in addition to that, a proper solution would be to wrap the if-else in an asynchronous call and continue the rest of the code of the function in the callback.
I might not be understanding something here. wdy think?
modified URL to upload solutions respective to the difficulty of the solution