Created
June 5, 2021 01:42
-
-
Save mosufy/29ae9b8ccbe52ad82e124f61830502b7 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
export const createNewAccount = async (params) => { | |
if (!validateCreateNewAccountParameters(params)) | |
throw new Error('Validation error'); | |
if (await checkUsernameExists(params.username)) | |
throw new Error('Username already exists'); | |
if (await checkEmailExists(params.email)) | |
throw new Error('Email already exists'); | |
return insertUser(params); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment