diff --git a/public/locales/en/auth.json b/public/locales/en/auth.json index b90e47de..d233c6a4 100644 --- a/public/locales/en/auth.json +++ b/public/locales/en/auth.json @@ -37,5 +37,8 @@ "enter": "Enter ", "sign_in": "Sign In", "sign_up": "Sign Up", - "signing_up": "Signing Up" + "signing_up": "Signing Up", + "github_login_success": "GitHub Login Success!", + "github_logging_in": "GitHub Logging in...", + "github_cb_tip": "Please close this window and return widget window" } diff --git a/public/locales/zh/auth.json b/public/locales/zh/auth.json index 39332014..bf56f435 100644 --- a/public/locales/zh/auth.json +++ b/public/locales/zh/auth.json @@ -37,5 +37,8 @@ "enter": "登入", "sign_in": "登录", "sign_up": "注册", - "signing_up": "注册中" + "signing_up": "注册中", + "github_login_success": "Github授权成功!", + "github_logging_in": "Github授权中...", + "github_cb_tip": "请关闭该窗口,并返回原界面" } diff --git a/src/routes/callback/GithubCallback.tsx b/src/routes/callback/GithubCallback.tsx index da7cccac..45ef9769 100644 --- a/src/routes/callback/GithubCallback.tsx +++ b/src/routes/callback/GithubCallback.tsx @@ -4,12 +4,14 @@ import { useLoginMutation } from "../../app/services/auth"; import toast from "react-hot-toast"; import { FetchBaseQueryError } from "@reduxjs/toolkit/dist/query"; import { useTranslation } from 'react-i18next'; +import StyledButton from '../../common/component/styled/Button'; export type GithubLoginSource = "widget" | "webapp" type Props = { code: string, from?: GithubLoginSource } const GithubCallback: FC = ({ code, from = "webapp" }) => { + const { t } = useTranslation("auth"); const { t: ct } = useTranslation(); //拿本地存的magic token const magic_token = localStorage.getItem(KEY_LOCAL_MAGIC_TOKEN); @@ -38,6 +40,7 @@ const GithubCallback: FC = ({ code, from = "webapp" }) => { }, [isSuccess, from]); useEffect(() => { if (error) { + console.log(error); // todo: why? switch ((error as FetchBaseQueryError).status) { case 410: @@ -49,13 +52,16 @@ const GithubCallback: FC = ({ code, from = "webapp" }) => { toast.error("Something Error"); break; } - return; } }, [error]); - if (error) return Something Error; + const handleClose = () => { + window.close(); + }; + if (error) return Something Error; return
- {isSuccess && from == 'widget' &&

Please close this window and return widget window

} - {isLoading ? "GitHub Logging in..." : "GitHub Login Success!"} + {ct("action.close")} + {isSuccess && from == 'widget' &&

{t("github_cb_tip")}

} + {isLoading ? t("github_logging_in") : t("github_login_success")}
; }; diff --git a/src/routes/callback/PaymentSuccess.tsx b/src/routes/callback/PaymentSuccess.tsx index f4b6f698..b85bfdc0 100644 --- a/src/routes/callback/PaymentSuccess.tsx +++ b/src/routes/callback/PaymentSuccess.tsx @@ -30,10 +30,10 @@ const PaymentSuccess = ({ sid }: Props) => { navigateTo("/"); }; return ( -
+
check icon

{t("payment_success")}

-

+

{upserting ? t("tip_renewing") : ""} {upserted ? t("tip_renewed") : ""} {isError ? t("tip_renew_error") : ""} diff --git a/src/routes/callback/index.tsx b/src/routes/callback/index.tsx index bffa95af..ab2dc5e4 100644 --- a/src/routes/callback/index.tsx +++ b/src/routes/callback/index.tsx @@ -5,7 +5,7 @@ import GithubCallback, { GithubLoginSource } from "./GithubCallback"; const StyledWrapper = ({ children }: DOMAttributes & { children?: ReactNode }) => { - return

+ return
{children}
; };