fix: overview
This commit is contained in:
@@ -334,7 +334,7 @@ export const serverApi = createApi({
|
||||
url: `/license`
|
||||
}),
|
||||
async onQueryStarted(data, { dispatch, queryFulfilled, getState }) {
|
||||
// vocechat官方demo 则忽略
|
||||
// vocechat 官方 demo 则忽略
|
||||
if (IS_OFFICIAL_DEMO) return;
|
||||
const rootStore = getState() as RootState;
|
||||
const { upgraded: prevValue } = rootStore.server;
|
||||
@@ -432,6 +432,7 @@ export const {
|
||||
useGetSMTPStatusQuery,
|
||||
useSendTestEmailMutation,
|
||||
useUpdateFirebaseConfigMutation,
|
||||
useGetFirebaseConfigQuery,
|
||||
useLazyGetFirebaseConfigQuery,
|
||||
useLazyGetAgoraConfigQuery,
|
||||
useLazyGetSMTPConfigQuery,
|
||||
|
||||
+19
-12
@@ -4,10 +4,10 @@ import { useTranslation } from "react-i18next";
|
||||
import { isEqual } from "lodash";
|
||||
|
||||
import {
|
||||
useLazyGetAgoraConfigQuery,
|
||||
useLazyGetFirebaseConfigQuery,
|
||||
useLazyGetLoginConfigQuery,
|
||||
useLazyGetSMTPConfigQuery,
|
||||
useGetAgoraConfigQuery,
|
||||
useGetFirebaseConfigQuery,
|
||||
useGetLoginConfigQuery,
|
||||
useGetSMTPConfigQuery,
|
||||
useUpdateAgoraConfigMutation,
|
||||
useUpdateFirebaseConfigMutation,
|
||||
useUpdateLoginConfigMutation,
|
||||
@@ -33,10 +33,21 @@ export default function useConfig(config: keyof ConfigMap = "smtp") {
|
||||
useUpdateAgoraConfigMutation();
|
||||
const [updateFirebaseConfig, { isSuccess: FirebaseUpdated, isLoading: FirebaseUpdating }] =
|
||||
useUpdateFirebaseConfigMutation();
|
||||
const [getAgoraConfig, { data: agoraConfig }] = useLazyGetAgoraConfigQuery();
|
||||
const [getLoginConfig, { data: loginConfig }] = useLazyGetLoginConfigQuery();
|
||||
const [getSMTPConfig, { data: smtpConfig }] = useLazyGetSMTPConfigQuery();
|
||||
const [getFirebaseConfig, { data: firebaseConfig }] = useLazyGetFirebaseConfigQuery();
|
||||
const { refetch: getAgoraConfig, data: agoraConfig } = useGetAgoraConfigQuery(undefined, {
|
||||
skip: config !== "agora"
|
||||
});
|
||||
const { refetch: getLoginConfig, data: loginConfig } = useGetLoginConfigQuery(undefined, {
|
||||
skip: config !== "login"
|
||||
});
|
||||
const { refetch: getSMTPConfig, data: smtpConfig } = useGetSMTPConfigQuery(undefined, {
|
||||
skip: config !== "smtp"
|
||||
});
|
||||
const { refetch: getFirebaseConfig, data: firebaseConfig } = useGetFirebaseConfigQuery(
|
||||
undefined,
|
||||
{
|
||||
skip: config !== "firebase"
|
||||
}
|
||||
);
|
||||
|
||||
const updateFns = {
|
||||
login: updateLoginConfig,
|
||||
@@ -79,10 +90,6 @@ export default function useConfig(config: keyof ConfigMap = "smtp") {
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
refetch();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (updated) {
|
||||
toast.success(ct("tip.update"));
|
||||
|
||||
Reference in New Issue
Block a user