feat(FE): API integration dashboard

This commit is contained in:
randy-ar
2026-01-11 19:15:22 +07:00
parent c752cad057
commit 0da9f9d651
13 changed files with 95 additions and 4423 deletions
+6 -11
View File
@@ -1,7 +1,7 @@
import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { Dashboard } from '@/types/api/dashboard/dashboard';
import { getDummySingle } from '@/dummy/dashboard/dashboard.production.dummy';
import { httpClientFetcher } from '@/services/http/client';
class DashboardService extends BaseApiService<Dashboard, unknown, unknown> {
constructor(basePath: string) {
@@ -12,19 +12,14 @@ class DashboardService extends BaseApiService<Dashboard, unknown, unknown> {
* Fetch dashboard production data
* @param endpoint - The endpoint URL with query parameters
* @returns Promise with BaseApiResponse containing DashboardProduction
*
* Note: Currently using dummy data. When real API is ready,
* uncomment the line below and remove getDummySingle() call:
* return await this.customRequest<BaseApiResponse<Dashboard>>(endpoint);
*/
async getDashboardProductionFetcher(
endpoint: string
): Promise<BaseApiResponse<Dashboard>> {
// For now, we're using dummy data regardless of the endpoint
// The endpoint parameter is kept for future API integration
console.log('Fetching dashboard data with endpoint:', endpoint);
return await getDummySingle();
): Promise<BaseApiResponse<Dashboard> | undefined> {
return await httpClientFetcher<BaseApiResponse<Dashboard>>(
`${endpoint ? endpoint : this.basePath}`
);
}
}
export const DashboardApi = new DashboardService('/dashboard');
export const DashboardApi = new DashboardService('/dashboards');