Task 5.25: Dashboard-System — GET /api/v1/dashboard/widgets, DashboardWidgetLoader, DashboardGrid with drag-and-drop, 3 example widgets (RecentContacts, TasksSummary, CalendarUpcoming), updated Dashboard.tsx, i18n, 6 tests
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Dashboard API hooks (Task 5.25).
|
||||
*/
|
||||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { apiGet } from './client';
|
||||
|
||||
export interface DashboardWidgetDef {
|
||||
id: string;
|
||||
label_key: string;
|
||||
label: string;
|
||||
component: string;
|
||||
icon: string;
|
||||
order: number;
|
||||
col_span: number;
|
||||
row_span: number;
|
||||
permission: string;
|
||||
plugin_name: string;
|
||||
}
|
||||
|
||||
export interface DashboardWidgetsResponse {
|
||||
items: DashboardWidgetDef[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function useDashboardWidgets() {
|
||||
return useQuery({
|
||||
queryKey: ['dashboardWidgets'],
|
||||
queryFn: () =>
|
||||
apiGet<DashboardWidgetsResponse>('/dashboard/widgets'),
|
||||
staleTime: 60 * 1000,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user