feat: 新增核心 API 客户端、认证服务(含令牌刷新和 GitHub OAuth)、图片管理功能及相关 UI 组件和测试。
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import api from './api';
|
||||
import type { CurrencyCode } from '../types';
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080/api/v1';
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:2612/api/v1';
|
||||
|
||||
// Report API Response Types
|
||||
export interface CurrencySummary {
|
||||
@@ -94,7 +94,7 @@ export const getTransactionSummary = async (
|
||||
params: SummaryParams
|
||||
): Promise<TransactionSummaryResponse> => {
|
||||
const response = await api.get<{ success: boolean; data: TransactionSummaryResponse }>(
|
||||
'/reports/summary',
|
||||
'/reports/summary',
|
||||
params as unknown as Record<string, string | number | boolean | undefined>
|
||||
);
|
||||
if (!response.data) {
|
||||
@@ -110,7 +110,7 @@ export const getCategorySummary = async (
|
||||
params: CategoryParams
|
||||
): Promise<CategorySummaryResponse> => {
|
||||
const response = await api.get<{ success: boolean; data: CategorySummaryResponse }>(
|
||||
'/reports/category',
|
||||
'/reports/category',
|
||||
params as unknown as Record<string, string | number | boolean | undefined>
|
||||
);
|
||||
if (!response.data) {
|
||||
@@ -126,7 +126,7 @@ export const getTrendData = async (
|
||||
params: TrendParams
|
||||
): Promise<TrendDataResponse> => {
|
||||
const response = await api.get<{ success: boolean; data: TrendDataResponse }>(
|
||||
'/reports/trend',
|
||||
'/reports/trend',
|
||||
params as unknown as Record<string, string | number | boolean | undefined>
|
||||
);
|
||||
if (!response.data) {
|
||||
@@ -163,15 +163,15 @@ export const exportReport = async (params: ExportParams): Promise<void> => {
|
||||
// Create a temporary anchor element and trigger download
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
|
||||
|
||||
// Generate filename based on date range and format
|
||||
const filename = `report_${params.start_date.replace(/-/g, '')}_to_${params.end_date.replace(/-/g, '')}.${params.format === 'pdf' ? 'pdf' : 'xlsx'}`;
|
||||
link.download = filename;
|
||||
|
||||
|
||||
// Trigger the download
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
|
||||
// Clean up
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
Reference in New Issue
Block a user