Created
July 21, 2019 16:48
-
-
Save jsmanifest/18db942b43eb0809ad7a8f58df8ccea7 to your computer and use it in GitHub Desktop.
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
| function createAccount({ | |
| username = '', | |
| password = '', | |
| nickname = '', | |
| email = '', | |
| gender = 'Male', | |
| bio = '', | |
| subscription = 'Basic', | |
| callback, | |
| }) { | |
| if (!username || !password || !email) { | |
| throw new Error( | |
| 'You are missing one or all of the following fields: "username", "password", "email"', | |
| ) | |
| } | |
| return api | |
| .createAccount({ | |
| username, | |
| password, | |
| nickname, | |
| email, | |
| gender, | |
| bio, | |
| subscription, | |
| }) | |
| .then((result) => { | |
| if (callback) callback(null, result) | |
| }) | |
| .catch((error) => { | |
| console.error(error) | |
| if (callback) callback(error) | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment