chore: update ts definition generator

This commit is contained in:
steven
2023-09-03 14:35:50 +08:00
parent 7cde25bdb5
commit 2fcd496fd2
29 changed files with 12178 additions and 55 deletions

View File

@ -1,20 +1,41 @@
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { Outlet, useNavigate } from "react-router-dom";
import { UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service";
import Header from "../components/Header";
import useUserStore from "../stores/v1/user";
const Root: React.FC = () => {
const navigate = useNavigate();
const currentUser = useUserStore().getCurrentUser();
const { i18n } = useTranslation();
const userStore = useUserStore();
const currentUser = userStore.getCurrentUser();
const currentUserSetting = userStore.getCurrentUserSetting();
useEffect(() => {
if (!currentUser) {
navigate("/auth", {
replace: true,
});
return;
}
// Prepare user setting.
userStore.fetchUserSetting(currentUser.id);
}, []);
useEffect(() => {
if (!currentUserSetting) {
return;
}
if (currentUserSetting.locale === UserSetting_Locale.LOCALE_EN) {
i18n.changeLanguage("en");
} else if (currentUserSetting.locale === UserSetting_Locale.LOCALE_ZH) {
i18n.changeLanguage("zh");
}
}, [currentUserSetting]);
return (
<>
{currentUser && (