refactor: social login buttons

This commit is contained in:
Tristan Yang
2022-06-22 12:04:14 +08:00
parent b3b6cd5d6f
commit 3e23c72b6d
7 changed files with 25 additions and 18 deletions
+9 -4
View File
@@ -84,13 +84,18 @@ export default function LoginPage() {
toast.error(error.data);
break;
case 401:
toast.error("username or password incorrect");
toast.error("Username or Password incorrect");
break;
case 404:
toast.error("account not exsit");
toast.error("Account not exist");
break;
case 410:
toast.error(
"No associated account found, please contact admin for an invitation link to join."
);
break;
default:
toast.error("something error");
toast.error("Something Error");
break;
}
return;
@@ -173,7 +178,7 @@ export default function LoginPage() {
{hasDivider && <hr className="or" />}
{enableMagicLink && <MagicLinkLogin />}
{googleLogin && <GoogleLoginButton clientId={clientId} />}
{enableGithubLogin && <GithubLoginButton config={githubAuthConfig} />}
{enableGithubLogin && <GithubLoginButton client_id={githubAuthConfig?.client_id} />}
{enableMetamaskLogin && <MetamaskLoginButton login={login} />}
{oidc.length > 0 && <OidcLoginButton issuers={oidc} />}
{whoCanSignUp === "EveryOne" && <SignUpLink />}
+4 -2
View File
@@ -139,8 +139,10 @@ export default function Reg() {
</Button>
</form>
<hr className="or" />
{googleLogin && <GoogleLoginButton clientId={clientId} />}
{enableGithubLogin && <GithubLoginButton config={githubAuthConfig} />}
{googleLogin && <GoogleLoginButton type="register" clientId={clientId} />}
{enableGithubLogin && (
<GithubLoginButton type="register" client_id={githubAuthConfig?.client_id} />
)}
<SignInLink />
</>
);
-2
View File
@@ -1,6 +1,4 @@
import { Outlet } from "react-router-dom";
// import { useMatch } from "react-router-dom";
import StyledWrapper from "./styled";
export default function RegContainer() {