import { getRecords, getStats, getCategories, getRecurringBills } from './api'; // 全局 SWR 配置 export const swrConfig = { refreshInterval: 0, // 默认不自动刷新 revalidateOnFocus: true, revalidateOnReconnect: true, dedupingInterval: 2000, errorRetryCount: 3, onError: (error) => { console.error('SWR Error:', error); }, }; // 数据获取器映射 export const fetchers = { records: (month, type) => getRecords(month, type), stats: (month) => getStats(month), categories: () => getCategories(), recurring: () => getRecurringBills(), };