diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7701e083..d45f93da 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -26,5 +26,5 @@
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
- "cSpell.words": ["btns", "rustchat"]
+ "cSpell.words": ["btns", "oidc", "rustchat"]
}
diff --git a/src/app/services/base.query.ts b/src/app/services/base.query.ts
index 8d65560f..20a3cf8d 100644
--- a/src/app/services/base.query.ts
+++ b/src/app/services/base.query.ts
@@ -84,7 +84,7 @@ const baseQueryWithTokenCheck = async (args, api, extraOptions) => {
break;
case 500:
{
- toast.error(result.error.data || "server error");
+ toast.error(result.error.data || "Server Error");
}
break;
case 401:
diff --git a/src/common/component/GithubLoginButton.tsx b/src/common/component/GithubLoginButton.tsx
index b27fe845..fbe95d10 100644
--- a/src/common/component/GithubLoginButton.tsx
+++ b/src/common/component/GithubLoginButton.tsx
@@ -1,5 +1,3 @@
-// import { useState, useEffect } from "react";
-// import { useGoogleLogin } from "react-google-login";
import IconGithub from "../../assets/icons/github.svg";
import styled from "styled-components";
import Button from "./styled/Button";
@@ -20,8 +18,12 @@ const StyledSocialButton = styled(Button)`
}
`;
-export default function GithubLoginButton({ config = {} }) {
- const { client_id } = config;
+type Props = {
+ client_id: string;
+ type?: "login" | "register";
+};
+
+export default function GithubLoginButton({ type = "login", client_id }: Props) {
const handleGithubLogin = () => {
location.href = `http://github.com/login/oauth/authorize?client_id=${client_id}`;
// console.log("github login");
@@ -30,8 +32,7 @@ export default function GithubLoginButton({ config = {} }) {
return (
- Sign in with Github
- {/* {loaded ? `Sign in with Github` : `Initailizing`} */}
+ {` ${type === "login" ? "Sign in" : "Sign up"} with Github`}
);
}
diff --git a/src/common/component/GoogleLoginButton.tsx b/src/common/component/GoogleLoginButton.tsx
index 9e5fd5c6..d4fabed2 100644
--- a/src/common/component/GoogleLoginButton.tsx
+++ b/src/common/component/GoogleLoginButton.tsx
@@ -24,9 +24,10 @@ const StyledSocialButton = styled(Button)`
interface Props {
clientId: string;
+ type?: "login" | "register";
}
-const GoogleLoginButton: FC = ({ clientId }) => {
+const GoogleLoginButton: FC = ({ type = "login", clientId }) => {
const [login, { isSuccess, isLoading }] = useLoginMutation();
const { signIn, loaded } = useGoogleLogin({
@@ -60,7 +61,7 @@ const GoogleLoginButton: FC = ({ clientId }) => {
return (
- {loaded ? `Sign in with Google` : `Initailizing`}
+ {loaded ? `${type === "login" ? "Sign in" : "Sign up"} with Google` : `Initializing`}
);
};
diff --git a/src/routes/login/index.tsx b/src/routes/login/index.tsx
index 433aa78a..ae4b8d44 100644
--- a/src/routes/login/index.tsx
+++ b/src/routes/login/index.tsx
@@ -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 &&
}
{enableMagicLink && }
{googleLogin && }
- {enableGithubLogin && }
+ {enableGithubLogin && }
{enableMetamaskLogin && }
{oidc.length > 0 && }
{whoCanSignUp === "EveryOne" && }
diff --git a/src/routes/reg/Register.tsx b/src/routes/reg/Register.tsx
index 0fc809cc..b8ede222 100644
--- a/src/routes/reg/Register.tsx
+++ b/src/routes/reg/Register.tsx
@@ -139,8 +139,10 @@ export default function Reg() {
- {googleLogin && }
- {enableGithubLogin && }
+ {googleLogin && }
+ {enableGithubLogin && (
+
+ )}
>
);
diff --git a/src/routes/reg/index.tsx b/src/routes/reg/index.tsx
index e7f7bf37..a47c69a5 100644
--- a/src/routes/reg/index.tsx
+++ b/src/routes/reg/index.tsx
@@ -1,6 +1,4 @@
import { Outlet } from "react-router-dom";
-// import { useMatch } from "react-router-dom";
-
import StyledWrapper from "./styled";
export default function RegContainer() {