fix: only load history for logged-in users

This commit is contained in:
chenos 2023-01-06 11:54:40 +08:00
parent 2cba502f60
commit 85a032f87c

View File

@ -38,12 +38,13 @@ export const CollectionHistoryProvider: React.FC = (props) => {
}); });
const isAdminPage = location.pathname.startsWith('/admin'); const isAdminPage = location.pathname.startsWith('/admin');
const token = api.auth.getToken() || '';
useEffect(() => { useEffect(() => {
if (isAdminPage) { if (isAdminPage && token) {
service.run(); service.run();
} }
}, [isAdminPage]); }, [isAdminPage, token]);
// 刷新 collecionHistory // 刷新 collecionHistory
const refreshCH = async () => { const refreshCH = async () => {