Last active
August 22, 2017 18:29
-
-
Save Kelin2025/36a3fe7ee9a1afea5123f842b4afc2be to your computer and use it in GitHub Desktop.
Example of incorrect API calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Example of boilerplate api call */ | |
let res = await get('/posts') | |
if (res.success) { | |
/* | |
Place data somewhere, success alert etc. | |
I really feel sorry for people | |
who still writes so in every call | |
just copy-paste and don't worry about | |
And I pretty sure that most of you will say | |
"Wtf do you talk? There is no another way" | |
*/ | |
} else { | |
/* | |
Alert or do something you usually do on error | |
That part often can be replaced | |
in throughout the project | |
just by Ctrl+H in folder | |
because the code is the same everywhere | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment