Skip to content

Commit

Permalink
fix signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
feruzm committed Feb 29, 2024
1 parent a89dbfa commit 36cea71
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/common/pages/sign-up.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import NavBar from "../components/navbar";
import { appleSvg, checkSvg, googleSvg, hiveSvg } from "../img/svg";
import { Tsx } from "../i18n/helper";
import { handleInvalid, handleOnInput } from "../util/input-util";
import { getAccount } from "../api/hive";
import { getAccounts } from "../api/hive";
import "./sign-up.scss";
import { Link } from "react-router-dom";
import { b64uEnc } from "../util/b64";
Expand Down Expand Up @@ -126,15 +126,15 @@ export const SignUp = (props: PageProps) => {
useDebounce(
() => {
if (username?.length >= 3) {
getAccount(username).then((r) => {
if (r) {
getAccounts([username]).then((r) => {
if (r.length > 0) {
setUsernameError(_t("sign-up.username-exists"));
setIsDisabled(true);
}
});
}
},
200,
1000,
[username]
);

Expand Down Expand Up @@ -283,14 +283,14 @@ export const SignUp = (props: PageProps) => {
return;
}

const existingAccount = await getAccount(username);
if (existingAccount) {
const existingAccount = await getAccounts([username]);
if (existingAccount.length > 0) {
setUsernameError(_t("sign-up.username-exists"));
return;
}

const referralIsValid = await getAccount(referral);
if (!referralIsValid && referral !== "") {
const referralIsValid = await getAccounts([referral]);
if (referralIsValid.length === 0 && referral !== "") {
setReferralError(_t("sign-up.referral-invalid"));
return;
}
Expand Down

0 comments on commit 36cea71

Please sign in to comment.