From 85a032f87cab58523b86994780d79f2394e5adf9 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 6 Jan 2023 11:54:40 +0800 Subject: [PATCH] fix: only load history for logged-in users --- .../src/collection-manager/CollectionHistoryProvider.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/collection-manager/CollectionHistoryProvider.tsx b/packages/core/client/src/collection-manager/CollectionHistoryProvider.tsx index 10b4e35cd2..c0bb92f434 100644 --- a/packages/core/client/src/collection-manager/CollectionHistoryProvider.tsx +++ b/packages/core/client/src/collection-manager/CollectionHistoryProvider.tsx @@ -38,12 +38,13 @@ export const CollectionHistoryProvider: React.FC = (props) => { }); const isAdminPage = location.pathname.startsWith('/admin'); + const token = api.auth.getToken() || ''; useEffect(() => { - if (isAdminPage) { + if (isAdminPage && token) { service.run(); } - }, [isAdminPage]); + }, [isAdminPage, token]); // 刷新 collecionHistory const refreshCH = async () => {