chore: i18n in toast

This commit is contained in:
Tristan Yang
2023-01-19 08:39:57 +08:00
parent 1f7baef4b6
commit fd8c54e702
34 changed files with 107 additions and 86 deletions
+3 -1
View File
@@ -6,8 +6,10 @@ import { useNavigate, useParams } from "react-router-dom";
import { useLoginMutation } from "../../app/services/auth";
import toast from "react-hot-toast";
import { setAuthData } from "../../app/slices/auth.data";
import { useTranslation } from "react-i18next";
export default function OAuthPage() {
const { t: ct } = useTranslation();
const [login, { data, isSuccess, isError }] = useLoginMutation();
const { token } = useParams();
const [loading, setLoading] = useState(true);
@@ -36,7 +38,7 @@ export default function OAuthPage() {
if (isSuccess && data) {
setLoading(false);
// 更新本地认证信息
toast.success("Login Successfully");
toast.success(ct("tip.login"));
dispatch(setAuthData(data));
navigateTo("/");
}