Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created July 21, 2019 16:49
Show Gist options
  • Select an option

  • Save jsmanifest/6cfba2d8cb0f6bcdbb24d83d393ed375 to your computer and use it in GitHub Desktop.

Select an option

Save jsmanifest/6cfba2d8cb0f6bcdbb24d83d393ed375 to your computer and use it in GitHub Desktop.
function createAccount({
password = '',
nickname = '',
email = '',
gender = 'Male',
bio = '',
subscription = 'Basic',
callback,
}) {
if (!password || !email) {
throw new Error(
'You are missing one or all of the following fields: "email", "password"',
)
}
return api
.createAccount({
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