From 1b02fade6dd3385948c025dbedba45358938e35f Mon Sep 17 00:00:00 2001 From: Minghan Zhang <112773885+zmh-program@users.noreply.github.com> Date: Sun, 2 Jun 2024 16:45:08 +0800 Subject: [PATCH] Revert "fix: remove repetitive quota refresh interval" --- app/src/components/home/SideBar.tsx | 23 +++-------------------- app/src/dialogs/QuotaDialog.tsx | 7 +++++-- app/src/dialogs/SubscriptionDialog.tsx | 3 +++ app/src/store/quota.ts | 15 ++++++--------- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/app/src/components/home/SideBar.tsx b/app/src/components/home/SideBar.tsx index d16817a..37b9456 100644 --- a/app/src/components/home/SideBar.tsx +++ b/app/src/components/home/SideBar.tsx @@ -1,6 +1,6 @@ import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; -import auth, { selectAuthenticated, selectUsername } from "@/store/auth.ts"; +import { selectAuthenticated, selectUsername } from "@/store/auth.ts"; import { closeMarket, selectCurrent, @@ -8,7 +8,7 @@ import { selectMaskItem, useConversationActions, } from "@/store/chat.ts"; -import React, { useCallback, useRef, useState } from "react"; +import React, { useRef, useState } from "react"; import { ConversationInstance } from "@/api/types.tsx"; import { useToast } from "@/components/ui/use-toast.ts"; import { extractMessage, filterMessage } from "@/utils/processor.ts"; @@ -46,9 +46,6 @@ import { goAuth } from "@/utils/app.ts"; import Avatar from "@/components/Avatar.tsx"; import { cn } from "@/components/ui/lib/utils.ts"; import { getNumberMemory } from "@/utils/memory.ts"; -import { refreshSubscription } from "@/store/subscription.ts"; -import { refreshQuota } from "@/store/quota.ts"; -import { AppDispatch } from "@/store"; type Operation = { target: ConversationInstance | null; @@ -332,25 +329,11 @@ function SidebarConversationList({ function SidebarMenu() { const username = useSelector(selectUsername); - const dispatch: AppDispatch = useDispatch(); - const updateQuota = useCallback(() => { - dispatch(refreshQuota()); // 调用 refreshQuota 更新配额 - }, [dispatch]); - const handleRefreshSubscription = async () => { - if (!auth) { - return; - } - await refreshSubscription(dispatch); - }; return (