Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const verifyUniqueUser = async (
{ username, email }: Omit,
userGetter: (...args: string[]) => Promise
) => {
const user: IUser = await userGetter(username, email);
if (user) {
if (user.username === username) {
throw new ApolloError("User name taken");
}
if (user.email === email) {
throw new ApolloError("Email taken");
}
return;
}
return {
username,
email
};
};
export const verifyUniqueUser = async (
{ username, email }: Omit,
userGetter: (...args: string[]) => Promise
) => {
const user: IUser = await userGetter(username, email);
if (user) {
if (user.username === username) {
throw new ApolloError("User name taken");
}
if (user.email === email) {
throw new ApolloError("Email taken");
}
return;
}
return {
username,
email
};
};