import axios from 'axios';

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000';

/**
 * 获取仪表盘统计数据
 * @param {number} userId - 用户ID
 * @returns {Promise<{today_generated: number, pending_review: number, published: number}>}
 */
export const getDashboardStats = async (userId) => {
  try {
    const response = await axios.get(`${API_BASE_URL}/api/v1/dashboard/stats`, {
      params: { user_id: userId }
    });
    return response.data;
  } catch (error) {
    console.error('获取仪表盘统计数据失败:', error);
    throw error;
  }
}; 