refactor: preload license info

This commit is contained in:
Tristan Yang
2023-03-23 13:50:29 +08:00
parent bb37f1b2e6
commit 049f7c75e3
5 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => {
export default function License() {
const { t, i18n } = useTranslation("setting");
// const { t: ct } = useTranslation();
const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense();
const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense(true);
const [modalVisible, setModalVisible] = useState(false);
const [updateVisible, setUpdateVisible] = useState(false);
const [base58Fold, setBase58Fold] = useState(true);
+2 -4
View File
@@ -14,7 +14,6 @@ import Version from "../../common/component/Version";
// import ConfigAgora from "./config/Agora";
import { useAppSelector } from "../../app/store";
import ServerVersionChecker from "../../common/component/ServerVersionChecker";
import useLicense from "../../common/hook/useLicense";
const navs = [
{
@@ -98,10 +97,9 @@ const navs = [
];
const useNavs = () => {
const { upgraded } = useLicense();
const { t } = useTranslation("setting");
const loginUser = useAppSelector((store) => {
return store.authData.user;
const { loginUser, upgraded } = useAppSelector((store) => {
return { loginUser: store.authData.user, upgraded: store.server.upgraded };
});
const transformedNavs = navs.map(n => {
const { name, items, ...rest } = n;